import { FCReactive, FCReactiveObject, configureReactive } from '@legendapp/state/react'; import { ActivityIndicator, ActivityIndicatorProps, Button, ButtonProps, FlatList, FlatListProps, Image, ImageProps, Pressable, PressableProps, ScrollView, ScrollViewProps, SectionList, SectionListProps, Switch, SwitchProps, Text, TextInput, TextInputProps, TextProps, TouchableWithoutFeedback, TouchableWithoutFeedbackProps, View, ViewProps, } from 'react-native'; export function enableReactNativeComponents() { configureReactive({ components: { ActivityIndicator: ActivityIndicator, Button: Button, FlatList: FlatList, Image: Image, Pressable: Pressable, ScrollView: ScrollView, SectionList: SectionList, Switch: Switch, Text: Text, TextInput: TextInput, TouchableWithoutFeedback: TouchableWithoutFeedback, View: View, }, binders: { TextInput: { value: { handler: 'onChange', getValue: (e) => e.nativeEvent.text, defaultValue: '', }, }, Switch: { value: { handler: 'onValueChange', getValue: (e) => e, defaultValue: false, }, }, }, }); } // Types: // eslint-disable-next-line @typescript-eslint/no-unused-vars import type { IReactive } from '@legendapp/state/react'; declare module '@legendapp/state/react' { interface IReactive extends FCReactiveObject { ActivityIndicator: FCReactive; Button: FCReactive; FlatList: FCReactive>; Image: FCReactive; Pressable: FCReactive; ScrollView: FCReactive; SectionList: FCReactive>; Switch: FCReactive; Text: FCReactive; TextInput: FCReactive; TouchableWithoutFeedback: FCReactive; View: FCReactive; } }