Added selection / keyboard navigation
Summary: per title Reviewed By: nikoant Differential Revision: D26368673 fbshipit-source-id: 7a458e28af1229ee8193dfe2a6d156afd9282acd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fb7c09c972
commit
1ce665ceaf
@@ -69,9 +69,14 @@ type StateOptions = {
|
||||
|
||||
export function createState<T>(
|
||||
initialValue: T,
|
||||
options?: StateOptions,
|
||||
): Atom<T>;
|
||||
export function createState<T>(): Atom<T | undefined>;
|
||||
export function createState(
|
||||
initialValue: any = undefined,
|
||||
options: StateOptions = {},
|
||||
): Atom<T> {
|
||||
const atom = new AtomValue<T>(initialValue);
|
||||
): Atom<any> {
|
||||
const atom = new AtomValue(initialValue);
|
||||
if (getCurrentPluginInstance() && options.persist) {
|
||||
const {rootStates} = getCurrentPluginInstance()!;
|
||||
if (rootStates[options.persist]) {
|
||||
|
||||
@@ -337,8 +337,12 @@ export class DataSource<
|
||||
return this.reverse ? this.output.length - 1 - viewIndex : viewIndex;
|
||||
}
|
||||
|
||||
getItem(viewIndex: number) {
|
||||
return this.output[this.normalizeIndex(viewIndex)].value;
|
||||
getItem(viewIndex: number): T {
|
||||
return this.getEntry(viewIndex)?.value;
|
||||
}
|
||||
|
||||
getEntry(viewIndex: number): Entry<T> {
|
||||
return this.output[this.normalizeIndex(viewIndex)];
|
||||
}
|
||||
|
||||
notifyItemUpdated(viewIndex: number) {
|
||||
|
||||
Reference in New Issue
Block a user