@draftbit/core 46.0.1-eb73d2.0 → 46.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Carousel.js +1 -3
- package/lib/commonjs/components/Carousel.js.map +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +3 -3
- package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/DeprecatedButton.js +4 -20
- package/lib/commonjs/components/DeprecatedButton.js.map +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -14
- package/lib/commonjs/components/DeprecatedCardWrapper.js.map +1 -1
- package/lib/commonjs/components/Justification.js +0 -3
- package/lib/commonjs/components/Picker/Picker.js +3 -3
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.android.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/commonjs/components/Picker/PickerComponent.web.js +2 -2
- package/lib/commonjs/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
- package/lib/commonjs/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/commonjs/components/ResizeMode.js +0 -3
- package/lib/commonjs/components/Stepper.js +1 -1
- package/lib/commonjs/components/Stepper.js.map +1 -1
- package/lib/commonjs/mappings/KeyboardAvoidingView.js +2 -2
- package/lib/commonjs/mappings/KeyboardAvoidingView.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonGroup.js.map +1 -1
- package/lib/commonjs/mappings/RadioButtonRow.js.map +1 -1
- package/lib/module/components/Button.js +11 -32
- package/lib/module/components/Button.js.map +1 -1
- package/lib/module/components/Card.js.map +1 -1
- package/lib/module/components/Carousel.js +1 -3
- package/lib/module/components/Carousel.js.map +1 -1
- package/lib/module/components/Checkbox/Checkbox.js.map +1 -1
- package/lib/module/components/Checkbox/index.js.map +1 -1
- package/lib/module/components/CircleImage.js +2 -16
- package/lib/module/components/CircleImage.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponent.web.js +3 -3
- package/lib/module/components/DatePicker/DatePickerComponent.web.js.map +1 -1
- package/lib/module/components/DatePicker/DatePickerComponentType.js.map +1 -1
- package/lib/module/components/DeprecatedFAB.js +4 -20
- package/lib/module/components/DeprecatedFAB.js.map +1 -1
- package/lib/module/components/Justification.js +1 -1
- package/lib/module/components/NumberInput.js +2 -13
- package/lib/module/components/NumberInput.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +3 -3
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +2 -2
- package/lib/module/components/Picker/PickerComponent.android.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/module/components/Picker/PickerComponent.ios.js.map +1 -1
- package/lib/module/components/Picker/PickerComponent.web.js +2 -2
- package/lib/module/components/Picker/PickerComponent.web.js.map +1 -1
- package/lib/module/components/Portal/PortalManager.js +1 -1
- package/lib/module/components/Portal/PortalManager.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +1 -1
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonGroup.js +4 -16
- package/lib/module/components/RadioButton/RadioButtonGroup.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButtonRow.js +7 -24
- package/lib/module/components/RadioButton/RadioButtonRow.js.map +1 -1
- package/lib/module/components/ResizeMode.js +1 -1
- package/lib/module/components/ScreenContainer.js +5 -21
- package/lib/module/components/ScreenContainer.js.map +1 -1
- package/lib/module/components/Stepper.js +1 -1
- package/lib/module/components/Stepper.js.map +1 -1
- package/lib/module/mappings/KeyboardAvoidingView.js +2 -2
- package/lib/module/mappings/KeyboardAvoidingView.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Checkbox/Checkbox.tsx +76 -77
- package/src/mappings/KeyboardAvoidingView.ts +2 -2
- package/src/Provider.js +0 -9
- package/src/components/Accordion/AccordionGroup.js +0 -44
- package/src/components/Accordion/AccordionItem.js +0 -32
- package/src/components/Accordion/index.js +0 -2
- package/src/components/ActionSheet/ActionSheet.js +0 -45
- package/src/components/ActionSheet/ActionSheetCancel.js +0 -6
- package/src/components/ActionSheet/ActionSheetItem.js +0 -30
- package/src/components/ActionSheet/index.js +0 -3
- package/src/components/AnimatedCircularProgress.js +0 -43
- package/src/components/AspectRatio.js +0 -18
- package/src/components/AvatarEdit.js +0 -30
- package/src/components/Banner.js +0 -109
- package/src/components/Button.js +0 -112
- package/src/components/Card.js +0 -57
- package/src/components/CardBlock.js +0 -54
- package/src/components/CardContainer.js +0 -69
- package/src/components/CardContainerRating.js +0 -79
- package/src/components/CardContainerShortImage.js +0 -33
- package/src/components/CardInline.js +0 -36
- package/src/components/Carousel.js +0 -66
- package/src/components/Checkbox/Checkbox.js +0 -63
- package/src/components/Checkbox/CheckboxGroup.js +0 -21
- package/src/components/Checkbox/CheckboxGroupRow.js +0 -77
- package/src/components/Checkbox/CheckboxRow.js +0 -78
- package/src/components/Checkbox/context.js +0 -14
- package/src/components/Checkbox/index.js +0 -3
- package/src/components/CircleImage.js +0 -8
- package/src/components/CircularProgress.js +0 -78
- package/src/components/Config.js +0 -63
- package/src/components/Container.js +0 -43
- package/src/components/DatePicker/DatePicker.js +0 -368
- package/src/components/DatePicker/DatePickerComponent.js +0 -13
- package/src/components/DatePicker/DatePickerComponent.web.js +0 -30
- package/src/components/DatePicker/DatePickerComponentType.js +0 -1
- package/src/components/DeprecatedButton.js +0 -95
- package/src/components/DeprecatedCardWrapper.js +0 -18
- package/src/components/DeprecatedFAB.js +0 -115
- package/src/components/Divider.js +0 -13
- package/src/components/Elevation.js +0 -20
- package/src/components/FAB.js +0 -46
- package/src/components/FieldSearchBarFull.js +0 -53
- package/src/components/FormRow.js +0 -19
- package/src/components/Header.js +0 -44
- package/src/components/HeaderLarge.js +0 -7
- package/src/components/HeaderMedium.js +0 -7
- package/src/components/HeaderOverline.js +0 -7
- package/src/components/IconButton.js +0 -35
- package/src/components/Image.js +0 -47
- package/src/components/Justification.js +0 -1
- package/src/components/Layout.js +0 -50
- package/src/components/NumberInput.js +0 -49
- package/src/components/Picker/Picker.js +0 -266
- package/src/components/Picker/PickerComponent.android.js +0 -68
- package/src/components/Picker/PickerComponent.ios.js +0 -78
- package/src/components/Picker/PickerComponent.web.js +0 -69
- package/src/components/Picker/PickerTypes.js +0 -1
- package/src/components/Portal/Portal.js +0 -35
- package/src/components/Portal/PortalConsumer.js +0 -28
- package/src/components/Portal/PortalHost.js +0 -105
- package/src/components/Portal/PortalManager.js +0 -29
- package/src/components/ProgressBar.js +0 -118
- package/src/components/ProgressCircle.js +0 -13
- package/src/components/ProgressIndicator.js +0 -27
- package/src/components/RadioButton/RadioButton.js +0 -17
- package/src/components/RadioButton/RadioButtonFieldGroup.js +0 -17
- package/src/components/RadioButton/RadioButtonGroup.js +0 -43
- package/src/components/RadioButton/RadioButtonRow.js +0 -76
- package/src/components/RadioButton/context.js +0 -14
- package/src/components/RadioButton/index.js +0 -4
- package/src/components/ResizeMode.js +0 -1
- package/src/components/Row.js +0 -48
- package/src/components/RowBodyIcon.js +0 -8
- package/src/components/RowHeadlineImageCaption.js +0 -12
- package/src/components/RowHeadlineImageIcon.js +0 -14
- package/src/components/ScreenContainer.js +0 -34
- package/src/components/Slider.js +0 -63
- package/src/components/StarRating.js +0 -50
- package/src/components/StepIndicator.js +0 -346
- package/src/components/Stepper.js +0 -39
- package/src/components/Surface.js +0 -32
- package/src/components/Swiper/Swiper.js +0 -29
- package/src/components/Swiper/SwiperItem.js +0 -9
- package/src/components/Swiper/index.js +0 -2
- package/src/components/Switch.js +0 -56
- package/src/components/Text.js +0 -28
- package/src/components/TextField.js +0 -420
- package/src/components/ToggleButton.js +0 -39
- package/src/components/Touchable.js +0 -12
- package/src/components/Touchable.web.js +0 -2
- package/src/components/Typography.js +0 -36
- package/src/components/useAuthState.js +0 -31
- package/src/constants.js +0 -10
- package/src/hooks.js +0 -12
- package/src/index.js +0 -52
- package/src/interfaces/Icon.js +0 -8
- package/src/mappings/Accordion.js +0 -41
- package/src/mappings/AccordionItem.js +0 -16
- package/src/mappings/ActionSheet.js +0 -13
- package/src/mappings/ActionSheetCancel.js +0 -19
- package/src/mappings/ActionSheetItem.js +0 -23
- package/src/mappings/ActivityIndicator.js +0 -53
- package/src/mappings/AudioPlayer.js +0 -20
- package/src/mappings/AvatarEdit.js +0 -37
- package/src/mappings/Banner.js +0 -32
- package/src/mappings/BlurView.js +0 -41
- package/src/mappings/Button.js +0 -56
- package/src/mappings/Card.js +0 -52
- package/src/mappings/CardBlock.js +0 -122
- package/src/mappings/CardContainer.js +0 -102
- package/src/mappings/CardContainerRating.js +0 -124
- package/src/mappings/CardContainerShortImage.js +0 -118
- package/src/mappings/CardInline.js +0 -51
- package/src/mappings/Carousel.js +0 -18
- package/src/mappings/Checkbox.js +0 -45
- package/src/mappings/CheckboxGroup.js +0 -25
- package/src/mappings/CheckboxRow.js +0 -56
- package/src/mappings/CircleImage.js +0 -24
- package/src/mappings/Container.js +0 -29
- package/src/mappings/CustomCode.js +0 -8
- package/src/mappings/DatePicker.js +0 -147
- package/src/mappings/Divider.js +0 -26
- package/src/mappings/FAB.js +0 -36
- package/src/mappings/Fetch.js +0 -12
- package/src/mappings/FieldSearchBarFull.js +0 -49
- package/src/mappings/FlatList.js +0 -19
- package/src/mappings/HeaderLarge.js +0 -28
- package/src/mappings/HeaderMedium.js +0 -54
- package/src/mappings/HeaderOverline.js +0 -54
- package/src/mappings/Icon.js +0 -25
- package/src/mappings/IconButton.js +0 -30
- package/src/mappings/Image.js +0 -15
- package/src/mappings/ImageBackground.js +0 -28
- package/src/mappings/KeyboardAvoidingView.js +0 -40
- package/src/mappings/KeyboardAwareScrollView.js +0 -49
- package/src/mappings/Layout.js +0 -195
- package/src/mappings/LinearGradient.js +0 -77
- package/src/mappings/MapCallout.js +0 -21
- package/src/mappings/MapMarker.js +0 -47
- package/src/mappings/MapView.js +0 -138
- package/src/mappings/Modal.js +0 -41
- package/src/mappings/Picker.js +0 -139
- package/src/mappings/ProgressBar.js +0 -100
- package/src/mappings/ProgressCircle.js +0 -108
- package/src/mappings/ProgressIndicator.js +0 -180
- package/src/mappings/RadioButton.js +0 -50
- package/src/mappings/RadioButtonGroup.js +0 -16
- package/src/mappings/RadioButtonRow.js +0 -37
- package/src/mappings/RowBodyIcon.js +0 -75
- package/src/mappings/RowHeadlineImageCaption.js +0 -167
- package/src/mappings/RowHeadlineImageIcon.js +0 -99
- package/src/mappings/SafeAreaView.js +0 -33
- package/src/mappings/ScrollView.js +0 -30
- package/src/mappings/Slider.js +0 -59
- package/src/mappings/StarRating.js +0 -42
- package/src/mappings/Stepper.js +0 -28
- package/src/mappings/Surface.js +0 -13
- package/src/mappings/Swiper.js +0 -60
- package/src/mappings/SwiperItem.js +0 -8
- package/src/mappings/Switch.js +0 -75
- package/src/mappings/Text.js +0 -232
- package/src/mappings/TextArea.js +0 -52
- package/src/mappings/TextField.js +0 -158
- package/src/mappings/TextInput.js +0 -208
- package/src/mappings/ToggleButton.js +0 -45
- package/src/mappings/Touchable.js +0 -12
- package/src/mappings/Video.js +0 -74
- package/src/mappings/View.js +0 -206
- package/src/mappings/WebView.js +0 -18
- package/src/styles/DarkTheme.js +0 -26
- package/src/styles/DefaultTheme.js +0 -111
- package/src/styles/fonts.js +0 -62
- package/src/styles/overlay.js +0 -60
- package/src/styles/shadow.js +0 -51
- package/src/theming.js +0 -3
- package/src/utilities.js +0 -102
|
@@ -2,10 +2,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { View, StyleSheet } from "react-native";
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* Portal host is the component which actually renders all Portals.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
9
|
export default class PortalManager extends React.PureComponent {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","StyleSheet","PortalManager","PureComponent","portals","key","children","setState","state","map","item","filter","render","
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","PortalManager","PureComponent","portals","key","children","setState","state","map","item","filter","render","absoluteFill"],"sources":["PortalManager.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { View, StyleSheet } from \"react-native\";\n\ntype State = {\n portals: Array<{\n key: number;\n children: React.ReactNode;\n }>;\n};\n\n/**\n * Portal host is the component which actually renders all Portals.\n */\nexport default class PortalManager extends React.PureComponent<{}, State> {\n state: State = {\n portals: [],\n };\n\n mount = (key: number, children: React.ReactNode) => {\n this.setState((state) => ({\n portals: [...state.portals, { key, children }],\n }));\n };\n\n update = (key: number, children: React.ReactNode) =>\n this.setState((state) => ({\n portals: state.portals.map((item) => {\n if (item.key === key) {\n return { ...item, children };\n }\n return item;\n }),\n }));\n\n unmount = (key: number) =>\n this.setState((state) => ({\n portals: state.portals.filter((item) => item.key !== key),\n }));\n\n render() {\n return this.state.portals.map(({ key, children }) => (\n <View\n key={key}\n collapsable={\n false /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */\n }\n pointerEvents=\"box-none\"\n style={StyleSheet.absoluteFill}\n >\n {children}\n </View>\n ));\n }\n}\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,EAAeC,UAAf,QAAiC,cAAjC;;AASA;AACA;AACA;AACA,eAAe,MAAMC,aAAN,SAA4BH,KAAK,CAACI,aAAlC,CAA2D;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const realContextValue = getValueForRadioButton(contextValue);
|
|
30
|
-
const isSelected = selected
|
|
30
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
31
31
|
|
|
32
32
|
const handlePress = () => {
|
|
33
33
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Config","IconButton","getValueForRadioButton","useRadioButtonGroupContext","RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress"],"sources":["RadioButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string | number;\n unselectedColor?: string;\n onPress?: (value?: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value = \"\",\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,0BAAT,QAA2C,WAA3C;;AAiBA,MAAMC,WAAuC,GAAG,QAa1C;EAAA,IAb2C;IAC/CC,IAD+C;IAE/CC,QAAQ,GAAG,KAFoC;IAG/CC,KAH+C;IAI/CC,KAAK,GAAG,EAJuC;IAK/CC,QAL+C;IAM/CC,eAN+C;IAO/CC,OAP+C;IAQ/CC,IAAI,GAAGZ,MAAM,CAACa,eARiC;IAS/CC,YAAY,GAAG,oCATgC;IAU/CC,cAAc,GAAG,sCAV8B;IAW/CC,KAX+C;IAY/C,GAAGC;EAZ4C,CAa3C;EACJ,MAAM;IAAET,KAAK,EAAEU,YAAT;IAAuBC;EAAvB,IAAyChB,0BAA0B,EAAzE;EAEA,MAAMiB,SAAS,GAAGlB,sBAAsB,CAACM,KAAD,CAAxC;EACA,MAAMa,gBAAgB,GAAGnB,sBAAsB,CAACgB,YAAD,CAA/C;EACA,MAAMI,UAAU,GAAGb,
|
|
1
|
+
{"version":3,"names":["React","Config","IconButton","getValueForRadioButton","useRadioButtonGroupContext","RadioButton","Icon","disabled","color","value","selected","unselectedColor","onPress","size","radioButtonSize","selectedIcon","unselectedIcon","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress"],"sources":["RadioButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { StyleProp, ViewStyle } from \"react-native\";\n\nimport Config from \"../Config\";\nimport IconButton from \"../IconButton\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { useRadioButtonGroupContext } from \"./context\";\n\nimport type { IconSlot } from \"../../interfaces/Icon\";\n\nexport type RadioButtonProps = {\n selected?: boolean;\n disabled?: boolean;\n color?: string;\n value?: string | number;\n unselectedColor?: string;\n onPress?: (value?: string) => void;\n style?: StyleProp<ViewStyle>;\n size?: number;\n selectedIcon?: string;\n unselectedIcon?: string;\n} & IconSlot;\n\nconst RadioButton: React.FC<RadioButtonProps> = ({\n Icon,\n disabled = false,\n color,\n value = \"\",\n selected,\n unselectedColor,\n onPress,\n size = Config.radioButtonSize,\n selectedIcon = \"MaterialIcons/radio-button-checked\",\n unselectedIcon = \"MaterialIcons/radio-button-unchecked\",\n style,\n ...rest\n}) => {\n const { value: contextValue, onValueChange } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n return (\n <IconButton\n Icon={Icon}\n icon={isSelected ? selectedIcon : unselectedIcon}\n color={isSelected ? color : unselectedColor}\n disabled={disabled}\n onPress={handlePress}\n size={size}\n style={style}\n {...rest}\n />\n );\n};\n\nexport default RadioButton;\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAGA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,0BAAT,QAA2C,WAA3C;;AAiBA,MAAMC,WAAuC,GAAG,QAa1C;EAAA,IAb2C;IAC/CC,IAD+C;IAE/CC,QAAQ,GAAG,KAFoC;IAG/CC,KAH+C;IAI/CC,KAAK,GAAG,EAJuC;IAK/CC,QAL+C;IAM/CC,eAN+C;IAO/CC,OAP+C;IAQ/CC,IAAI,GAAGZ,MAAM,CAACa,eARiC;IAS/CC,YAAY,GAAG,oCATgC;IAU/CC,cAAc,GAAG,sCAV8B;IAW/CC,KAX+C;IAY/C,GAAGC;EAZ4C,CAa3C;EACJ,MAAM;IAAET,KAAK,EAAEU,YAAT;IAAuBC;EAAvB,IAAyChB,0BAA0B,EAAzE;EAEA,MAAMiB,SAAS,GAAGlB,sBAAsB,CAACM,KAAD,CAAxC;EACA,MAAMa,gBAAgB,GAAGnB,sBAAsB,CAACgB,YAAD,CAA/C;EACA,MAAMI,UAAU,GAAGb,QAAQ,IAAIY,gBAAgB,KAAKD,SAApD;;EAEA,MAAMG,WAAW,GAAG,MAAM;IACxBZ,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAGS,SAAH,CAAP;IACAD,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGC,SAAH,CAAb;EACD,CAHD;;EAKA,oBACE,oBAAC,UAAD;IACE,IAAI,EAAEf,IADR;IAEE,IAAI,EAAEiB,UAAU,GAAGR,YAAH,GAAkBC,cAFpC;IAGE,KAAK,EAAEO,UAAU,GAAGf,KAAH,GAAWG,eAH9B;IAIE,QAAQ,EAAEJ,QAJZ;IAKE,OAAO,EAAEiB,WALX;IAME,IAAI,EAAEX,IANR;IAOE,KAAK,EAAEI;EAPT,GAQMC,IARN,EADF;AAYD,CArCD;;AAuCA,eAAeb,WAAf"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import { View } from "react-native";
|
|
3
5
|
import { getValueForRadioButton } from "../../utilities";
|
|
@@ -46,24 +48,10 @@ const RadioButtonGroup = _ref => {
|
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
51
|
+
return /*#__PURE__*/React.createElement(View, _extends({
|
|
50
52
|
style: [{
|
|
51
53
|
minHeight: 40
|
|
52
|
-
}, style]
|
|
53
|
-
...rest
|
|
54
|
-
}, /*#__PURE__*/React.createElement(Provider, {
|
|
55
|
-
value: {
|
|
56
|
-
value: internalValue,
|
|
57
|
-
onValueChange: handleValueChange,
|
|
58
|
-
direction
|
|
59
|
-
}
|
|
60
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
61
|
-
style: _containerStyle
|
|
62
|
-
}, children)));
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default RadioButtonGroup;
|
|
66
|
-
//# sourceMappingURL=RadioButtonGroup.js.map }, style]
|
|
54
|
+
}, style]
|
|
67
55
|
}, rest), /*#__PURE__*/React.createElement(Provider, {
|
|
68
56
|
value: {
|
|
69
57
|
value: internalValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","getValueForRadioButton","radioButtonGroupContext","Direction","Provider","RadioButtonGroup","direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horizontal","push","alignItems","
|
|
1
|
+
{"version":3,"names":["React","View","getValueForRadioButton","radioButtonGroupContext","Direction","Provider","RadioButtonGroup","direction","Vertical","value","onValueChange","defaultValue","style","children","rest","internalValue","setInternalValue","useState","useEffect","realValue","realDefaultValue","handleValueChange","newValue","realNewValue","_containerStyle","flexDirection","Horizontal","push","alignItems","minHeight"],"sources":["RadioButtonGroup.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { View, StyleProp, ViewStyle } from \"react-native\";\nimport type { Theme } from \"../../styles/DefaultTheme\";\nimport { getValueForRadioButton } from \"../../utilities\";\nimport { radioButtonGroupContext, Direction } from \"./context\";\nexport interface RadioButtonGroupProps {\n direction?: Direction;\n style?: StyleProp<ViewStyle>;\n value: string | number;\n onValueChange?: (value: string) => void;\n defaultValue?: string | number;\n theme: Theme;\n children: React.ReactNode;\n}\n\nconst { Provider } = radioButtonGroupContext;\n\nconst RadioButtonGroup: React.FC<RadioButtonGroupProps> = ({\n direction = Direction.Vertical,\n value = \"\",\n onValueChange,\n defaultValue,\n style,\n children,\n ...rest\n}) => {\n const [internalValue, setInternalValue] = React.useState(\"\");\n\n React.useEffect(() => {\n if (value != null) {\n const realValue = getValueForRadioButton(value);\n\n setInternalValue(realValue);\n }\n }, [value]);\n\n React.useEffect(() => {\n if (defaultValue != null) {\n const realDefaultValue = getValueForRadioButton(defaultValue);\n\n setInternalValue(realDefaultValue);\n }\n }, [defaultValue]);\n\n const handleValueChange = (newValue: string | number) => {\n const realNewValue = getValueForRadioButton(newValue);\n\n setInternalValue(realNewValue);\n onValueChange?.(realNewValue);\n };\n\n const _containerStyle: StyleProp<ViewStyle> = [\n {\n flexDirection: direction === Direction.Horizontal ? \"row\" : \"column\",\n },\n ];\n\n if (direction !== Direction.Vertical) {\n _containerStyle.push({\n alignItems: \"center\",\n });\n }\n\n return (\n <View style={[{ minHeight: 40 }, style]} {...rest}>\n <Provider\n value={{\n value: internalValue,\n onValueChange: handleValueChange,\n direction,\n }}\n >\n <View style={_containerStyle}>{children}</View>\n </Provider>\n </View>\n );\n};\n\nexport default RadioButtonGroup;\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAA2C,cAA3C;AAEA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,uBAAT,EAAkCC,SAAlC,QAAmD,WAAnD;AAWA,MAAM;EAAEC;AAAF,IAAeF,uBAArB;;AAEA,MAAMG,gBAAiD,GAAG,QAQpD;EAAA,IARqD;IACzDC,SAAS,GAAGH,SAAS,CAACI,QADmC;IAEzDC,KAAK,GAAG,EAFiD;IAGzDC,aAHyD;IAIzDC,YAJyD;IAKzDC,KALyD;IAMzDC,QANyD;IAOzD,GAAGC;EAPsD,CAQrD;EACJ,MAAM,CAACC,aAAD,EAAgBC,gBAAhB,IAAoChB,KAAK,CAACiB,QAAN,CAAe,EAAf,CAA1C;EAEAjB,KAAK,CAACkB,SAAN,CAAgB,MAAM;IACpB,IAAIT,KAAK,IAAI,IAAb,EAAmB;MACjB,MAAMU,SAAS,GAAGjB,sBAAsB,CAACO,KAAD,CAAxC;MAEAO,gBAAgB,CAACG,SAAD,CAAhB;IACD;EACF,CAND,EAMG,CAACV,KAAD,CANH;EAQAT,KAAK,CAACkB,SAAN,CAAgB,MAAM;IACpB,IAAIP,YAAY,IAAI,IAApB,EAA0B;MACxB,MAAMS,gBAAgB,GAAGlB,sBAAsB,CAACS,YAAD,CAA/C;MAEAK,gBAAgB,CAACI,gBAAD,CAAhB;IACD;EACF,CAND,EAMG,CAACT,YAAD,CANH;;EAQA,MAAMU,iBAAiB,GAAIC,QAAD,IAA+B;IACvD,MAAMC,YAAY,GAAGrB,sBAAsB,CAACoB,QAAD,CAA3C;IAEAN,gBAAgB,CAACO,YAAD,CAAhB;IACAb,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAGa,YAAH,CAAb;EACD,CALD;;EAOA,MAAMC,eAAqC,GAAG,CAC5C;IACEC,aAAa,EAAElB,SAAS,KAAKH,SAAS,CAACsB,UAAxB,GAAqC,KAArC,GAA6C;EAD9D,CAD4C,CAA9C;;EAMA,IAAInB,SAAS,KAAKH,SAAS,CAACI,QAA5B,EAAsC;IACpCgB,eAAe,CAACG,IAAhB,CAAqB;MACnBC,UAAU,EAAE;IADO,CAArB;EAGD;;EAED,oBACE,oBAAC,IAAD;IAAM,KAAK,EAAE,CAAC;MAAEC,SAAS,EAAE;IAAb,CAAD,EAAoBjB,KAApB;EAAb,GAA6CE,IAA7C,gBACE,oBAAC,QAAD;IACE,KAAK,EAAE;MACLL,KAAK,EAAEM,aADF;MAELL,aAAa,EAAEW,iBAFV;MAGLd;IAHK;EADT,gBAOE,oBAAC,IAAD;IAAM,KAAK,EAAEiB;EAAb,GAA+BX,QAA/B,CAPF,CADF,CADF;AAaD,CA3DD;;AA6DA,eAAeP,gBAAf"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import { StyleSheet, View, Platform } from "react-native";
|
|
3
5
|
import RadioButton from "./RadioButton";
|
|
@@ -6,7 +8,7 @@ import { useRadioButtonGroupContext } from "./context";
|
|
|
6
8
|
import { Direction as GroupDirection } from "./context";
|
|
7
9
|
import Touchable from "../Touchable";
|
|
8
10
|
import { extractStyles, getValueForRadioButton } from "../../utilities";
|
|
9
|
-
export
|
|
11
|
+
export let Direction;
|
|
10
12
|
|
|
11
13
|
(function (Direction) {
|
|
12
14
|
Direction["Row"] = "row";
|
|
@@ -57,7 +59,7 @@ const RadioButtonRow = _ref => {
|
|
|
57
59
|
} = useRadioButtonGroupContext();
|
|
58
60
|
const realValue = getValueForRadioButton(value);
|
|
59
61
|
const realContextValue = getValueForRadioButton(contextValue);
|
|
60
|
-
const isSelected = selected
|
|
62
|
+
const isSelected = selected ?? realContextValue === realValue;
|
|
61
63
|
|
|
62
64
|
const handlePress = () => {
|
|
63
65
|
onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
|
|
@@ -68,14 +70,13 @@ const RadioButtonRow = _ref => {
|
|
|
68
70
|
textStyles,
|
|
69
71
|
viewStyles
|
|
70
72
|
} = extractStyles(style);
|
|
71
|
-
return /*#__PURE__*/React.createElement(Touchable, {
|
|
73
|
+
return /*#__PURE__*/React.createElement(Touchable, _extends({
|
|
72
74
|
onPress: handlePress,
|
|
73
75
|
style: [styles.mainParent, {
|
|
74
76
|
flexDirection: direction
|
|
75
77
|
}, viewStyles],
|
|
76
|
-
disabled: disabled
|
|
77
|
-
|
|
78
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
78
|
+
disabled: disabled
|
|
79
|
+
}, rest), /*#__PURE__*/React.createElement(View, {
|
|
79
80
|
style: [styles.label, {
|
|
80
81
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
81
82
|
}, labelContainerStyle]
|
|
@@ -114,22 +115,4 @@ const styles = StyleSheet.create({
|
|
|
114
115
|
}
|
|
115
116
|
});
|
|
116
117
|
export default RadioButtonRow;
|
|
117
|
-
//# sourceMappingURL=RadioButtonRow.js.map"center",
|
|
118
|
-
justifyContent: "space-around",
|
|
119
|
-
paddingStart: 20,
|
|
120
|
-
minHeight: 50,
|
|
121
|
-
paddingEnd: 20,
|
|
122
|
-
display: "flex",
|
|
123
|
-
...Platform.select({
|
|
124
|
-
web: {
|
|
125
|
-
cursor: "pointer",
|
|
126
|
-
userSelect: "none"
|
|
127
|
-
}
|
|
128
|
-
})
|
|
129
|
-
},
|
|
130
|
-
label: {
|
|
131
|
-
flex: 3
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
export default RadioButtonRow;
|
|
135
118
|
//# sourceMappingURL=RadioButtonRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","Platform","RadioButton","Text","useRadioButtonGroupContext","Direction","GroupDirection","Touchable","extractStyles","getValueForRadioButton","getRadioButtonAlignment","parentDirection","direction","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","View","Platform","RadioButton","Text","useRadioButtonGroupContext","Direction","GroupDirection","Touchable","extractStyles","getValueForRadioButton","getRadioButtonAlignment","parentDirection","direction","Horizontal","Row","RowReverse","renderLabel","value","labelStyle","textStyle","RadioButtonRow","Icon","label","color","unselectedColor","onPress","labelContainerStyle","radioButtonStyle","selected","disabled","style","rest","contextValue","onValueChange","realValue","realContextValue","isSelected","handlePress","textStyles","viewStyles","styles","mainParent","flexDirection","alignItems","flex","create","justifyContent","paddingStart","minHeight","paddingEnd","display","select","web","cursor","userSelect"],"sources":["RadioButtonRow.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n StyleProp,\n ViewStyle,\n StyleSheet,\n TextStyle,\n View,\n Platform,\n} from \"react-native\";\nimport RadioButton, { RadioButtonProps } from \"./RadioButton\";\nimport Text from \"../Text\";\nimport { useRadioButtonGroupContext } from \"./context\";\nimport type { IconSlot } from \"../../interfaces/Icon\";\nimport { Direction as GroupDirection } from \"./context\";\nimport Touchable from \"../Touchable\";\nimport { extractStyles, getValueForRadioButton } from \"../../utilities\";\n\nexport enum Direction {\n Row = \"row\",\n RowReverse = \"row-reverse\",\n}\n\nexport interface RadioButtonRowProps extends Omit<RadioButtonProps, \"onPress\"> {\n label: string | React.ReactNode;\n value: string | number; // A string (or number that will be parsed String(number)) that this radio button row represents when selected\n color?: string;\n unselectedColor?: string;\n labelContainerStyle: StyleProp<ViewStyle>;\n radioButtonStyle?: StyleProp<ViewStyle>;\n labelStyle?: StyleProp<TextStyle>;\n onPress?: (value: string) => void;\n direction?: Direction;\n}\n\nconst getRadioButtonAlignment = (\n parentDirection: GroupDirection | undefined,\n direction: Direction\n) => {\n if (parentDirection === GroupDirection.Horizontal) {\n return direction === Direction.Row ? \"flex-start\" : \"flex-end\";\n } else if (direction === Direction.RowReverse) {\n return \"flex-start\";\n } else {\n return \"flex-end\";\n }\n};\n\nconst renderLabel = (\n value: string | React.ReactNode,\n labelStyle: StyleProp<TextStyle>,\n textStyle: StyleProp<TextStyle>\n) => {\n if (typeof value === \"string\") {\n return <Text style={[labelStyle, textStyle]}>{value}</Text>;\n } else {\n return <>{value}</>;\n }\n};\n\nconst RadioButtonRow: React.FC<RadioButtonRowProps & IconSlot> = ({\n Icon,\n label,\n value = \"\",\n color,\n unselectedColor,\n onPress,\n labelContainerStyle,\n labelStyle,\n radioButtonStyle,\n direction = Direction.Row,\n selected,\n disabled,\n style,\n ...rest\n}) => {\n const {\n value: contextValue,\n onValueChange,\n direction: parentDirection,\n } = useRadioButtonGroupContext();\n\n const realValue = getValueForRadioButton(value);\n const realContextValue = getValueForRadioButton(contextValue);\n const isSelected = selected ?? realContextValue === realValue;\n\n const handlePress = () => {\n onPress?.(realValue);\n onValueChange?.(realValue);\n };\n\n const { textStyles, viewStyles } = extractStyles(style);\n\n return (\n <Touchable\n onPress={handlePress}\n style={[styles.mainParent, { flexDirection: direction }, viewStyles]}\n disabled={disabled}\n {...rest}\n >\n <View\n style={[\n styles.label,\n {\n alignItems: direction === Direction.Row ? \"flex-start\" : \"flex-end\",\n },\n labelContainerStyle,\n ]}\n >\n {renderLabel(label, labelStyle, textStyles)}\n </View>\n <View\n style={{\n flex: 1,\n alignItems: getRadioButtonAlignment(parentDirection, direction),\n }}\n >\n <RadioButton\n Icon={Icon}\n selected={isSelected}\n value={realValue}\n color={color}\n unselectedColor={unselectedColor}\n style={radioButtonStyle}\n />\n </View>\n </Touchable>\n );\n};\n\nconst styles = StyleSheet.create({\n mainParent: {\n alignItems: \"center\",\n justifyContent: \"space-around\",\n paddingStart: 20,\n minHeight: 50,\n paddingEnd: 20,\n display: \"flex\",\n ...Platform.select({\n web: {\n cursor: \"pointer\",\n userSelect: \"none\",\n },\n }),\n },\n label: {\n flex: 3,\n },\n});\n\nexport default RadioButtonRow;\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAGEC,UAHF,EAKEC,IALF,EAMEC,QANF,QAOO,cAPP;AAQA,OAAOC,WAAP,MAA8C,eAA9C;AACA,OAAOC,IAAP,MAAiB,SAAjB;AACA,SAASC,0BAAT,QAA2C,WAA3C;AAEA,SAASC,SAAS,IAAIC,cAAtB,QAA4C,WAA5C;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,SAASC,aAAT,EAAwBC,sBAAxB,QAAsD,iBAAtD;AAEA,WAAYJ,SAAZ;;WAAYA,S;EAAAA,S;EAAAA,S;GAAAA,S,KAAAA,S;;AAiBZ,MAAMK,uBAAuB,GAAG,CAC9BC,eAD8B,EAE9BC,SAF8B,KAG3B;EACH,IAAID,eAAe,KAAKL,cAAc,CAACO,UAAvC,EAAmD;IACjD,OAAOD,SAAS,KAA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,EAAE;EADD;AAfwB,CAAlB,CAAf;AAoBA,eAAexB,cAAf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
//# sourceMappingURL=ResizeMode.js.
|
|
2
|
+
//# sourceMappingURL=ResizeMode.js.map
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
1
3
|
import * as React from "react";
|
|
2
4
|
import { StyleSheet, ScrollView, View } from "react-native";
|
|
3
5
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -25,13 +27,12 @@ function ScreenContainer(_ref) {
|
|
|
25
27
|
edges.push("bottom");
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
return /*#__PURE__*/React.createElement(SafeAreaView, {
|
|
30
|
+
return /*#__PURE__*/React.createElement(SafeAreaView, _extends({
|
|
29
31
|
edges: edges,
|
|
30
32
|
style: [styles.container, {
|
|
31
33
|
backgroundColor
|
|
32
|
-
}]
|
|
33
|
-
|
|
34
|
-
}, scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
|
|
34
|
+
}]
|
|
35
|
+
}, rest), scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
|
|
35
36
|
contentContainerStyle: [styles.scrollViewContainer, {
|
|
36
37
|
backgroundColor
|
|
37
38
|
}, style]
|
|
@@ -42,23 +43,6 @@ function ScreenContainer(_ref) {
|
|
|
42
43
|
}, children));
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const styles = StyleSheet.create({
|
|
46
|
-
container: {
|
|
47
|
-
flex: 1
|
|
48
|
-
},
|
|
49
|
-
scrollViewContainer: {
|
|
50
|
-
flexGrow: 1,
|
|
51
|
-
flex: undefined
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
export default withTheme(ScreenContainer);
|
|
55
|
-
//# sourceMappingURL=ScreenContainer.js.mapE__*/React.createElement(View, {
|
|
56
|
-
style: [styles.container, {
|
|
57
|
-
backgroundColor
|
|
58
|
-
}, style]
|
|
59
|
-
}, children));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
46
|
const styles = StyleSheet.create({
|
|
63
47
|
container: {
|
|
64
48
|
flex: 1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","ScrollView","View","SafeAreaView","withTheme","ScreenContainer","scrollable","hasSafeArea","hasBottomSafeArea","hasTopSafeArea","theme","style","children","rest","backgroundColor","colors","background","edges","push","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","ScrollView","View","SafeAreaView","withTheme","ScreenContainer","scrollable","hasSafeArea","hasBottomSafeArea","hasTopSafeArea","theme","style","children","rest","backgroundColor","colors","background","edges","push","styles","container","scrollViewContainer","create","flex","flexGrow","undefined"],"sources":["ScreenContainer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n StyleSheet,\n ScrollView,\n StyleProp,\n ViewStyle,\n View,\n} from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport type { Edge } from \"react-native-safe-area-context\";\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\n\ntype ScreenContainerProps = {\n scrollable: boolean;\n hasSafeArea: boolean;\n hasTopSafeArea: boolean;\n hasBottomSafeArea: boolean;\n theme: Theme;\n style?: StyleProp<ViewStyle>;\n children?: React.ReactNode;\n};\n\nfunction ScreenContainer({\n scrollable = false,\n hasSafeArea = false,\n hasBottomSafeArea = false,\n hasTopSafeArea = false,\n theme,\n style,\n children,\n ...rest\n}: ScreenContainerProps) {\n const backgroundColor = theme.colors.background;\n\n const edges: Edge[] = [\"left\", \"right\"];\n if (hasSafeArea || hasTopSafeArea) {\n edges.push(\"top\");\n }\n\n if (hasSafeArea || hasBottomSafeArea) {\n edges.push(\"bottom\");\n }\n\n return (\n <SafeAreaView\n edges={edges}\n style={[\n styles.container,\n {\n backgroundColor,\n },\n ]}\n {...rest}\n >\n {scrollable ? (\n <ScrollView\n contentContainerStyle={[\n styles.scrollViewContainer,\n { backgroundColor },\n style,\n ]}\n >\n {children}\n </ScrollView>\n ) : (\n <View style={[styles.container, { backgroundColor }, style]}>\n {children}\n </View>\n )}\n </SafeAreaView>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n scrollViewContainer: {\n flexGrow: 1,\n flex: undefined,\n },\n});\n\nexport default withTheme(ScreenContainer);\n"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SACEC,UADF,EAEEC,UAFF,EAKEC,IALF,QAMO,cANP;AAOA,SAASC,YAAT,QAA6B,gCAA7B;AAEA,SAASC,SAAT,QAA0B,YAA1B;;AAaA,SAASC,eAAT,OASyB;EAAA,IATA;IACvBC,UAAU,GAAG,KADU;IAEvBC,WAAW,GAAG,KAFS;IAGvBC,iBAAiB,GAAG,KAHG;IAIvBC,cAAc,GAAG,KAJM;IAKvBC,KALuB;IAMvBC,KANuB;IAOvBC,QAPuB;IAQvB,GAAGC;EARoB,CASA;EACvB,MAAMC,eAAe,GAAGJ,KAAK,CAACK,MAAN,CAAaC,UAArC;EAEA,MAAMC,KAAa,GAAG,CAAC,MAAD,EAAS,OAAT,CAAtB;;EACA,IAAIV,WAAW,IAAIE,cAAnB,EAAmC;IACjCQ,KAAK,CAACC,IAAN,CAAW,KAAX;EACD;;EAED,IAAIX,WAAW,IAAIC,iBAAnB,EAAsC;IACpCS,KAAK,CAACC,IAAN,CAAW,QAAX;EACD;;EAED,oBACE,oBAAC,YAAD;IACE,KAAK,EAAED,KADT;IAEE,KAAK,EAAE,CACLE,MAAM,CAACC,SADF,EAEL;MACEN;IADF,CAFK;EAFT,GAQMD,IARN,GAUGP,UAAU,gBACT,oBAAC,UAAD;IACE,qBAAqB,EAAE,CACrBa,MAAM,CAACE,mBADc,EAErB;MAAEP;IAAF,CAFqB,EAGrBH,KAHqB;EADzB,GAOGC,QAPH,CADS,gBAWT,oBAAC,IAAD;IAAM,KAAK,EAAE,CAACO,MAAM,CAACC,SAAR,EAAmB;MAAEN;IAAF,CAAnB,EAAwCH,KAAxC;EAAb,GACGC,QADH,CArBJ,CADF;AA4BD;;AAED,MAAMO,MAAM,GAAGnB,UAAU,CAACsB,MAAX,CAAkB;EAC/BF,SAAS,EAAE;IACTG,IAAI,EAAE;EADG,CADoB;EAI/BF,mBAAmB,EAAE;IACnBG,QAAQ,EAAE,CADS;IAEnBD,IAAI,EAAEE;EAFa;AAJU,CAAlB,CAAf;AAUA,eAAerB,SAAS,CAACC,eAAD,CAAxB"}
|
|
@@ -21,7 +21,7 @@ const Stepper = _ref => {
|
|
|
21
21
|
},
|
|
22
22
|
Icon
|
|
23
23
|
} = _ref;
|
|
24
|
-
const [value, setValue] = useState(defaultValue
|
|
24
|
+
const [value, setValue] = useState(defaultValue ?? 0);
|
|
25
25
|
|
|
26
26
|
const isValidValue = valueArg => valueArg >= min && valueArg <= max;
|
|
27
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","View","Text","isNumber","withTheme","IconButton","Stepper","min","Infinity","max","value","valueProp","defaultValue","style","typeStyle","iconSize","iconColor","onChange","theme","colors","typography","Icon","setValue","isValidValue","valueArg","handlePlusOrMinus","type","newValue","flexDirection","opacity","body1","textAlign","alignSelf","color","medium","marginHorizontal"],"sources":["Stepper.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from \"react\";\nimport { View, Text, StyleProp, ViewStyle, TextStyle } from \"react-native\";\nimport { isNumber } from \"lodash\";\n\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\nimport IconButton from \"./IconButton\";\n\ntype Props = {\n min: number;\n max: number;\n value?: number;\n defaultValue?: number;\n style?: StyleProp<ViewStyle>;\n typeStyle?: StyleProp<TextStyle>;\n iconSize: number;\n iconColor?: string;\n onChange?: (value: number) => void;\n theme: Theme;\n} & IconSlot;\n\nconst Stepper: FC<Props> = ({\n min = -Infinity,\n max = Infinity,\n value: valueProp,\n defaultValue,\n style,\n typeStyle,\n iconSize = 24,\n iconColor,\n onChange,\n theme: { colors, typography },\n Icon,\n}) => {\n const [value, setValue] = useState(defaultValue ?? 0);\n\n const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;\n\n const handlePlusOrMinus = (type: \"plus\" | \"minus\") => {\n const newValue = type === \"plus\" ? value + 1 : value - 1;\n\n if (isValidValue(newValue)) {\n setValue(newValue);\n onChange?.(newValue);\n }\n };\n\n useEffect(() => {\n if (\n valueProp != null &&\n isNumber(valueProp) &&\n valueProp !== value &&\n isValidValue(valueProp)\n ) {\n setValue(valueProp);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [valueProp]);\n\n return (\n <View style={[{ flexDirection: \"row\" }, style]}>\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/remove\"\n onPress={() => handlePlusOrMinus(\"minus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === min}\n style={{ opacity: value === min ? 0.5 : 1 }}\n />\n\n <Text\n style={[\n typography.body1,\n {\n textAlign: \"center\",\n alignSelf: \"center\",\n color: colors.medium,\n marginHorizontal: 8,\n },\n typeStyle,\n ]}\n >\n {value}\n </Text>\n\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/add\"\n onPress={() => handlePlusOrMinus(\"plus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === max}\n style={{ opacity: value === max ? 0.5 : 1 }}\n />\n </View>\n );\n};\n\nexport default withTheme(Stepper);\n"],"mappings":"AAAA,OAAOA,KAAP,IAAoBC,SAApB,EAA+BC,QAA/B,QAA+C,OAA/C;AACA,SAASC,IAAT,EAAeC,IAAf,QAA4D,cAA5D;AACA,SAASC,QAAT,QAAyB,QAAzB;AAEA,SAASC,SAAT,QAA0B,YAA1B;AAGA,OAAOC,UAAP,MAAuB,cAAvB;;AAeA,MAAMC,OAAkB,GAAG,QAYrB;EAAA,IAZsB;IAC1BC,GAAG,GAAG,CAACC,QADmB;IAE1BC,GAAG,GAAGD,QAFoB;IAG1BE,KAAK,EAAEC,SAHmB;IAI1BC,YAJ0B;IAK1BC,KAL0B;IAM1BC,SAN0B;IAO1BC,QAAQ,GAAG,EAPe;IAQ1BC,SAR0B;IAS1BC,QAT0B;IAU1BC,KAAK,EAAE;MAAEC,MAAF;MAAUC;IAAV,CAVmB;IAW1BC;EAX0B,CAYtB;EACJ,MAAM,CAACX,KAAD,EAAQY,QAAR,IAAoBtB,QAAQ,CAACY,
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","View","Text","isNumber","withTheme","IconButton","Stepper","min","Infinity","max","value","valueProp","defaultValue","style","typeStyle","iconSize","iconColor","onChange","theme","colors","typography","Icon","setValue","isValidValue","valueArg","handlePlusOrMinus","type","newValue","flexDirection","opacity","body1","textAlign","alignSelf","color","medium","marginHorizontal"],"sources":["Stepper.tsx"],"sourcesContent":["import React, { FC, useEffect, useState } from \"react\";\nimport { View, Text, StyleProp, ViewStyle, TextStyle } from \"react-native\";\nimport { isNumber } from \"lodash\";\n\nimport { withTheme } from \"../theming\";\nimport type { Theme } from \"../styles/DefaultTheme\";\nimport type { IconSlot } from \"../interfaces/Icon\";\nimport IconButton from \"./IconButton\";\n\ntype Props = {\n min: number;\n max: number;\n value?: number;\n defaultValue?: number;\n style?: StyleProp<ViewStyle>;\n typeStyle?: StyleProp<TextStyle>;\n iconSize: number;\n iconColor?: string;\n onChange?: (value: number) => void;\n theme: Theme;\n} & IconSlot;\n\nconst Stepper: FC<Props> = ({\n min = -Infinity,\n max = Infinity,\n value: valueProp,\n defaultValue,\n style,\n typeStyle,\n iconSize = 24,\n iconColor,\n onChange,\n theme: { colors, typography },\n Icon,\n}) => {\n const [value, setValue] = useState(defaultValue ?? 0);\n\n const isValidValue = (valueArg: number) => valueArg >= min && valueArg <= max;\n\n const handlePlusOrMinus = (type: \"plus\" | \"minus\") => {\n const newValue = type === \"plus\" ? value + 1 : value - 1;\n\n if (isValidValue(newValue)) {\n setValue(newValue);\n onChange?.(newValue);\n }\n };\n\n useEffect(() => {\n if (\n valueProp != null &&\n isNumber(valueProp) &&\n valueProp !== value &&\n isValidValue(valueProp)\n ) {\n setValue(valueProp);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [valueProp]);\n\n return (\n <View style={[{ flexDirection: \"row\" }, style]}>\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/remove\"\n onPress={() => handlePlusOrMinus(\"minus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === min}\n style={{ opacity: value === min ? 0.5 : 1 }}\n />\n\n <Text\n style={[\n typography.body1,\n {\n textAlign: \"center\",\n alignSelf: \"center\",\n color: colors.medium,\n marginHorizontal: 8,\n },\n typeStyle,\n ]}\n >\n {value}\n </Text>\n\n <IconButton\n Icon={Icon}\n icon=\"MaterialIcons/add\"\n onPress={() => handlePlusOrMinus(\"plus\")}\n size={iconSize}\n color={iconColor}\n disabled={value === max}\n style={{ opacity: value === max ? 0.5 : 1 }}\n />\n </View>\n );\n};\n\nexport default withTheme(Stepper);\n"],"mappings":"AAAA,OAAOA,KAAP,IAAoBC,SAApB,EAA+BC,QAA/B,QAA+C,OAA/C;AACA,SAASC,IAAT,EAAeC,IAAf,QAA4D,cAA5D;AACA,SAASC,QAAT,QAAyB,QAAzB;AAEA,SAASC,SAAT,QAA0B,YAA1B;AAGA,OAAOC,UAAP,MAAuB,cAAvB;;AAeA,MAAMC,OAAkB,GAAG,QAYrB;EAAA,IAZsB;IAC1BC,GAAG,GAAG,CAACC,QADmB;IAE1BC,GAAG,GAAGD,QAFoB;IAG1BE,KAAK,EAAEC,SAHmB;IAI1BC,YAJ0B;IAK1BC,KAL0B;IAM1BC,SAN0B;IAO1BC,QAAQ,GAAG,EAPe;IAQ1BC,SAR0B;IAS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;EAPT,EADF,eAWE,oBAAC,IAAD;IACE,KAAK,EAAE,CACLa,UAAU,CAACU,KADN,EAEL;MACEC,SAAS,EAAE,QADb;MAEEC,SAAS,EAAE,QAFb;MAGEC,KAAK,EAAEd,MAAM,CAACe,MAHhB;MAIEC,gBAAgB,EAAE;IAJpB,CAFK,EAQLrB,SARK;EADT,GAYGJ,KAZH,CAXF,eA0BE,oBAAC,UAAD;IACE,IAAI,EAAEW,IADR;IAEE,IAAI,EAAC,mBAFP;IAGE,OAAO,EAAE,MAAMI,iBAAiB,CAAC,MAAD,CAHlC;IAIE,IAAI,EAAEV,QAJR;IAKE,KAAK,EAAEC,SALT;IAME,QAAQ,EAAEN,KAAK,KAAKD,GANtB;IAOE,KAAK,EAAE;MAAEoB,OAAO,EAAEnB,KAAK,KAAKD,GAAV,GAAgB,GAAhB,GAAsB;IAAjC;EAPT,EA1BF,CADF;AAsCD,CA5ED;;AA8EA,eAAeL,SAAS,CAACE,OAAD,CAAxB"}
|
|
@@ -3,10 +3,10 @@ export const SEED_DATA = {
|
|
|
3
3
|
name: "Keyboard Avoiding View",
|
|
4
4
|
tag: "KeyboardAvoidingView",
|
|
5
5
|
description: "View that moves out of the way of the virtual keyboard. ",
|
|
6
|
-
category: COMPONENT_TYPES.
|
|
6
|
+
category: COMPONENT_TYPES.layout,
|
|
7
7
|
props: {
|
|
8
8
|
enabled: {
|
|
9
|
-
label: "
|
|
9
|
+
label: "Enabled",
|
|
10
10
|
description: "Enable the keyboard avoiding view",
|
|
11
11
|
editable: true,
|
|
12
12
|
required: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","GROUPS","SEED_DATA","name","tag","description","category","
|
|
1
|
+
{"version":3,"names":["COMPONENT_TYPES","FORM_TYPES","PROP_TYPES","GROUPS","SEED_DATA","name","tag","description","category","layout","props","enabled","label","editable","required","defaultValue","formType","boolean","propType","BOOLEAN","group","basic","behavior","options","flatArray","STRING","keyboardVerticalOffset","number","NUMBER"],"sources":["KeyboardAvoidingView.ts"],"sourcesContent":["import {\n COMPONENT_TYPES,\n FORM_TYPES,\n PROP_TYPES,\n GROUPS,\n} from \"@draftbit/types\";\n\nexport const SEED_DATA = {\n name: \"Keyboard Avoiding View\",\n tag: \"KeyboardAvoidingView\",\n description: \"View that moves out of the way of the virtual keyboard. \",\n category: COMPONENT_TYPES.layout,\n props: {\n enabled: {\n label: \"Enabled\",\n description: \"Enable the keyboard avoiding view\",\n editable: true,\n required: true,\n defaultValue: true,\n formType: FORM_TYPES.boolean,\n propType: PROP_TYPES.BOOLEAN,\n group: GROUPS.basic,\n },\n behavior: {\n label: \"Resizing Behavior\",\n description:\n \"The behavior for how the keyboard resizing interacts with the rest of the screen. (Default: padding).\",\n editable: true,\n required: true,\n defaultValue: \"padding\",\n options: [\"padding\", \"position\", \"height\"],\n formType: FORM_TYPES.flatArray,\n propType: PROP_TYPES.STRING,\n group: GROUPS.basic,\n },\n keyboardVerticalOffset: {\n label: \"Keyboard Vertical Offset\",\n description:\n \"The distance between the bottom of the view and the keyboard\",\n editable: true,\n required: false,\n defaultValue: 0,\n formType: FORM_TYPES.number,\n propType: PROP_TYPES.NUMBER,\n group: GROUPS.basic,\n },\n },\n};\n"],"mappings":"AAAA,SACEA,eADF,EAEEC,UAFF,EAGEC,UAHF,EAIEC,MAJF,QAKO,iBALP;AAOA,OAAO,MAAMC,SAAS,GAAG;EACvBC,IAAI,EAAE,wBADiB;EAEvBC,GAAG,EAAE,sBAFkB;EAGvBC,WAAW,EAAE,0DAHU;EAIvBC,QAAQ,EAAER,eAAe,CAACS,MAJH;EAKvBC,KAAK,EAAE;IACLC,OAAO,EAAE;MACPC,KAAK,EAAE,SADA;MAEPL,WAAW,EAAE,mCAFN;MAGPM,QAAQ,EAAE,IAHH;MAIPC,QAAQ,EAAE,IAJH;MAKPC,YAAY,EAAE,IALP;MAMPC,QAAQ,EAAEf,UAAU,CAACgB,OANd;MAOPC,QAAQ,EAAEhB,UAAU,CAACiB,OAPd;MAQPC,KAAK,EAAEjB,MAAM,CAACkB;IARP,CADJ;IAWLC,QAAQ,EAAE;MACRV,KAAK,EAAE,mBADC;MAERL,WAAW,EACT,uGAHM;MAIRM,QAAQ,EAAE,IAJF;MAKRC,QAAQ,EAAE,IALF;MAMRC,YAAY,EAAE,SANN;MAORQ,OAAO,EAAE,CAAC,SAAD,EAAY,UAAZ,EAAwB,QAAxB,CAPD;MAQRP,QAAQ,EAAEf,UAAU,CAACuB,SARb;MASRN,QAAQ,EAAEhB,UAAU,CAACuB,MATb;MAURL,KAAK,EAAEjB,MAAM,CAACkB;IAVN,CAXL;IAuBLK,sBAAsB,EAAE;MACtBd,KAAK,EAAE,0BADe;MAEtBL,WAAW,EACT,8DAHoB;MAItBM,QAAQ,EAAE,IAJY;MAKtBC,QAAQ,EAAE,KALY;MAMtBC,YAAY,EAAE,CANQ;MAOtBC,QAAQ,EAAEf,UAAU,CAAC0B,MAPC;MAQtBT,QAAQ,EAAEhB,UAAU,CAAC0B,MARC;MAStBR,KAAK,EAAEjB,MAAM,CAACkB;IATQ;EAvBnB;AALgB,CAAlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.0.
|
|
3
|
+
"version": "46.0.2",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
]
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "4c0a4f430a28d4dab70a8c926afcb90921643656"
|
|
82
82
|
}
|
|
@@ -27,94 +27,93 @@ export interface CheckboxProps {
|
|
|
27
27
|
style?: StyleProp<ViewStyle>;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const Checkbox: React.FC<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
const Checkbox: React.FC<
|
|
31
|
+
CheckboxProps & TouchableHighlightProps & IconSlot
|
|
32
|
+
> = ({
|
|
33
|
+
Icon,
|
|
34
|
+
status,
|
|
35
|
+
disabled = false,
|
|
36
|
+
onPress,
|
|
37
|
+
onCheck,
|
|
38
|
+
onUncheck,
|
|
39
|
+
color,
|
|
40
|
+
uncheckedColor,
|
|
41
|
+
defaultValue,
|
|
42
|
+
checkedIcon = "MaterialCommunityIcons/checkbox-marked",
|
|
43
|
+
uncheckedIcon = "MaterialCommunityIcons/checkbox-blank-outline",
|
|
44
|
+
size = 24,
|
|
45
|
+
style,
|
|
46
|
+
...rest
|
|
47
|
+
}) => {
|
|
48
|
+
const [internalValue, setInternalValue] = React.useState<boolean>(
|
|
49
|
+
status || defaultValue || false
|
|
50
|
+
);
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
if (status != null) {
|
|
54
|
+
setInternalValue(status);
|
|
55
|
+
}
|
|
56
|
+
}, [status]);
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
| boolean
|
|
61
|
-
| undefined;
|
|
58
|
+
// This special logic is to handle weird APIs like Airtable that return
|
|
59
|
+
// true or undefined for a boolean
|
|
60
|
+
const previousDefaultValue = usePrevious(defaultValue) as boolean | undefined;
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
if (defaultValue !== previousDefaultValue) {
|
|
64
|
+
setInternalValue(Boolean(defaultValue));
|
|
65
|
+
}
|
|
66
|
+
}, [defaultValue, previousDefaultValue]);
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
const { colors } = useTheme();
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const checkboxColor = internalValue
|
|
71
|
+
? color || colors.primary
|
|
72
|
+
: uncheckedColor || colors.primary;
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const handlePress = () => {
|
|
75
|
+
const newValue = !internalValue;
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
setInternalValue(newValue);
|
|
78
|
+
onPress?.(newValue);
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
if (newValue) {
|
|
81
|
+
onCheck?.();
|
|
82
|
+
}
|
|
84
83
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
if (!newValue) {
|
|
85
|
+
onUncheck?.();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
89
|
+
return (
|
|
90
|
+
<Touchable
|
|
91
|
+
{...rest}
|
|
92
|
+
onPress={handlePress}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
accessibilityState={{ disabled }}
|
|
95
|
+
accessibilityRole="button"
|
|
96
|
+
accessibilityLiveRegion="polite"
|
|
97
|
+
style={[styles.container, style, { width: size, height: size }]}
|
|
98
|
+
>
|
|
99
|
+
<Icon
|
|
100
|
+
style={styles.icon}
|
|
101
|
+
name={internalValue ? checkedIcon : uncheckedIcon}
|
|
102
|
+
size={size}
|
|
103
|
+
color={checkboxColor}
|
|
104
|
+
/>
|
|
105
|
+
<View style={[StyleSheet.absoluteFill, styles.fillContainer]}>
|
|
106
|
+
<View
|
|
107
|
+
style={[
|
|
108
|
+
styles.fill,
|
|
109
|
+
{ opacity: disabled ? 0.5 : 1 },
|
|
110
|
+
{ borderColor: checkboxColor },
|
|
111
|
+
]}
|
|
105
112
|
/>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{ opacity: disabled ? 0.5 : 1 },
|
|
111
|
-
{ borderColor: checkboxColor },
|
|
112
|
-
]}
|
|
113
|
-
/>
|
|
114
|
-
</View>
|
|
115
|
-
</Touchable>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
113
|
+
</View>
|
|
114
|
+
</Touchable>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
118
117
|
|
|
119
118
|
const styles = StyleSheet.create({
|
|
120
119
|
container: {
|
|
@@ -9,10 +9,10 @@ export const SEED_DATA = {
|
|
|
9
9
|
name: "Keyboard Avoiding View",
|
|
10
10
|
tag: "KeyboardAvoidingView",
|
|
11
11
|
description: "View that moves out of the way of the virtual keyboard. ",
|
|
12
|
-
category: COMPONENT_TYPES.
|
|
12
|
+
category: COMPONENT_TYPES.layout,
|
|
13
13
|
props: {
|
|
14
14
|
enabled: {
|
|
15
|
-
label: "
|
|
15
|
+
label: "Enabled",
|
|
16
16
|
description: "Enable the keyboard avoiding view",
|
|
17
17
|
editable: true,
|
|
18
18
|
required: true,
|
package/src/Provider.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { ThemeProvider } from "./theming";
|
|
3
|
-
import PortalHost from "./components/Portal/PortalHost";
|
|
4
|
-
export default class Provider extends React.Component {
|
|
5
|
-
render() {
|
|
6
|
-
return (React.createElement(PortalHost, null,
|
|
7
|
-
React.createElement(ThemeProvider, { theme: this.props.theme }, this.props.children)));
|
|
8
|
-
}
|
|
9
|
-
}
|