Added selection / keyboard navigation

Summary: per title

Reviewed By: nikoant

Differential Revision: D26368673

fbshipit-source-id: 7a458e28af1229ee8193dfe2a6d156afd9282acd
This commit is contained in:
Michel Weststrate
2021-03-16 14:54:53 -07:00
committed by Facebook GitHub Bot
parent fb7c09c972
commit 1ce665ceaf
7 changed files with 202 additions and 67 deletions

View File

@@ -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]) {