@draftbit/core 46.4.4-41266b.2 → 46.4.4-5206b0.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.
Files changed (38) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +5 -25
  2. package/lib/commonjs/components/Picker/Picker.js +5 -5
  3. package/lib/commonjs/components/Portal/PortalManager.js +19 -11
  4. package/lib/commonjs/components/Swiper/Swiper.js +0 -2
  5. package/lib/commonjs/components/Text.js +6 -2
  6. package/lib/commonjs/components/TextField.js +5 -1
  7. package/lib/commonjs/constants.js +1 -1
  8. package/lib/commonjs/mappings/Swiper.js +0 -1
  9. package/lib/commonjs/mappings/TextField.js +1 -1
  10. package/lib/commonjs/mappings/TextInput.js +1 -1
  11. package/lib/module/components/Picker/Picker.js +2 -2
  12. package/lib/module/components/Swiper/Swiper.js +0 -2
  13. package/lib/module/components/Text.js +6 -2
  14. package/lib/module/components/TextField.js +5 -1
  15. package/lib/module/mappings/Swiper.js +1 -2
  16. package/lib/module/mappings/TextField.js +1 -1
  17. package/lib/module/mappings/TextInput.js +1 -1
  18. package/lib/typescript/src/components/Swiper/Swiper.d.ts +1 -2
  19. package/lib/typescript/src/components/Text.d.ts +2 -1
  20. package/lib/typescript/src/components/TextField.d.ts +2 -1
  21. package/lib/typescript/src/mappings/Swiper.d.ts +0 -1
  22. package/lib/typescript/src/mappings/TextField.d.ts +2 -2
  23. package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
  24. package/package.json +3 -3
  25. package/src/components/Picker/Picker.js +1 -1
  26. package/src/components/Picker/Picker.tsx +2 -2
  27. package/src/components/Swiper/Swiper.js +2 -2
  28. package/src/components/Swiper/Swiper.tsx +0 -3
  29. package/src/components/Text.js +8 -2
  30. package/src/components/Text.tsx +6 -1
  31. package/src/components/TextField.js +6 -1
  32. package/src/components/TextField.tsx +7 -1
  33. package/src/mappings/Swiper.js +1 -2
  34. package/src/mappings/Swiper.ts +0 -2
  35. package/src/mappings/TextField.js +1 -1
  36. package/src/mappings/TextField.ts +1 -1
  37. package/src/mappings/TextInput.js +1 -1
  38. package/src/mappings/TextInput.ts +1 -1
@@ -21,6 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
 
24
+ 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); }
25
+
24
26
  const AccordionItem = _ref => {
25
27
  let {
26
28
  Icon,
@@ -35,10 +37,9 @@ const AccordionItem = _ref => {
35
37
  textStyles,
36
38
  viewStyles
37
39
  } = (0, _utilities.extractStyles)(style);
38
- return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
39
- style: [styles.container, viewStyles],
40
- ...rest
41
- }, /*#__PURE__*/React.createElement(_reactNative.View, {
40
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
41
+ style: [styles.container, viewStyles]
42
+ }, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
42
43
  style: styles.row
43
44
  }, icon ? /*#__PURE__*/React.createElement(Icon, {
44
45
  name: icon,
@@ -73,25 +74,4 @@ const styles = _reactNative.StyleSheet.create({
73
74
 
74
75
  var _default = (0, _theming.withTheme)(AccordionItem);
75
76
 
76
- exports.default = _default;StyleSheet.create({
77
- container: {
78
- padding: 8
79
- },
80
- row: {
81
- flexDirection: "row",
82
- alignItems: "center",
83
- paddingLeft: 8
84
- },
85
- item: {
86
- marginVertical: 6,
87
- paddingLeft: 8
88
- },
89
- content: {
90
- flex: 1,
91
- justifyContent: "center"
92
- }
93
- });
94
-
95
- var _default = (0, _theming.withTheme)(AccordionItem);
96
-
97
77
  exports.default = _default;
@@ -284,10 +284,6 @@ const Picker = _ref => {
284
284
  );
285
285
  };
286
286
 
287
- var _default = (0, _theming.withTheme)(Picker);
288
-
289
- exports.default = _default;
290
-
291
287
  const styles = _reactNative.StyleSheet.create({
292
288
  marginsContainer: {
293
289
  alignSelf: "stretch",
@@ -357,4 +353,8 @@ const styles = _reactNative.StyleSheet.create({
357
353
  maxWidth: deviceWidth,
358
354
  maxHeight: deviceHeight
359
355
  }
360
- });
356
+ });
357
+
358
+ var _default = (0, _theming.withTheme)(Picker);
359
+
360
+ exports.default = _default;
@@ -13,29 +13,26 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
-
18
16
  /**
19
17
  * Portal host is the component which actually renders all Portals.
20
18
  */
21
19
  class PortalManager extends React.PureComponent {
22
20
  constructor() {
23
21
  super(...arguments);
24
-
25
- _defineProperty(this, "state", {
22
+ this.state = {
26
23
  portals: []
27
- });
24
+ };
28
25
 
29
- _defineProperty(this, "mount", (key, children) => {
26
+ this.mount = (key, children) => {
30
27
  this.setState(state => ({
31
28
  portals: [...state.portals, {
32
29
  key,
33
30
  children
34
31
  }]
35
32
  }));
36
- });
33
+ };
37
34
 
38
- _defineProperty(this, "update", (key, children) => this.setState(state => ({
35
+ this.update = (key, children) => this.setState(state => ({
39
36
  portals: state.portals.map(item => {
40
37
  if (item.key === key) {
41
38
  return { ...item,
@@ -45,11 +42,11 @@ class PortalManager extends React.PureComponent {
45
42
 
46
43
  return item;
47
44
  })
48
- })));
45
+ }));
49
46
 
50
- _defineProperty(this, "unmount", key => this.setState(state => ({
47
+ this.unmount = key => this.setState(state => ({
51
48
  portals: state.portals.filter(item => item.key !== key)
52
- })));
49
+ }));
53
50
  }
54
51
 
55
52
  render() {
@@ -71,4 +68,15 @@ class PortalManager extends React.PureComponent {
71
68
 
72
69
  }
73
70
 
71
+ exports.default = PortalManager;le: false
72
+ /* Need collapsable=false here to clip the elevations, otherwise they appear above sibling components */
73
+ ,
74
+ pointerEvents: "box-none",
75
+ style: _reactNative.StyleSheet.absoluteFill
76
+ }, children);
77
+ });
78
+ }
79
+
80
+ }
81
+
74
82
  exports.default = PortalManager;
@@ -30,7 +30,6 @@ const Swiper = _ref => {
30
30
  keyExtractor,
31
31
  renderItem,
32
32
  children,
33
- onIndexChanged,
34
33
  style
35
34
  } = _ref;
36
35
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -40,7 +39,6 @@ const Swiper = _ref => {
40
39
  loop: loop,
41
40
  timeout: timeout,
42
41
  vertical: vertical,
43
- onIndexChanged: onIndexChanged,
44
42
  controlsProps: {
45
43
  prevTitle,
46
44
  nextTitle,
@@ -24,10 +24,14 @@ class Text extends React.Component {
24
24
  super(...arguments);
25
25
 
26
26
  _defineProperty(this, "_root", void 0);
27
+
28
+ _defineProperty(this, "state", {
29
+ nativeProps: {}
30
+ });
27
31
  }
28
32
 
29
33
  setNativeProps(args) {
30
- return this._root && this._root.setNativeProps(args);
34
+ this.state.nativeProps = args || {};
31
35
  }
32
36
 
33
37
  render() {
@@ -36,7 +40,7 @@ class Text extends React.Component {
36
40
  ...rest
37
41
  } = this.props;
38
42
  const writingDirection = _reactNative.I18nManager.isRTL ? "rtl" : "ltr";
39
- return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, {
43
+ return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, this.state.nativeProps, {
40
44
  ref: c => {
41
45
  this._root = c;
42
46
  },
@@ -32,6 +32,7 @@ class TextField extends React.Component {
32
32
  super(...arguments);
33
33
 
34
34
  _defineProperty(this, "state", {
35
+ nativeProps: {},
35
36
  labeled: new _reactNative.Animated.Value(this.props.value || this.props.error ? 0 : 1),
36
37
  focused: false,
37
38
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -162,7 +163,9 @@ class TextField extends React.Component {
162
163
  * @internal
163
164
  */
164
165
  setNativeProps(args) {
165
- return this._root && this._root.setNativeProps(args);
166
+ this.setState(state => ({ ...state,
167
+ nativeState: args || {}
168
+ }));
166
169
  }
167
170
 
168
171
  isFocused() {
@@ -444,6 +447,7 @@ class TextField extends React.Component {
444
447
  underlineColorAndroid: "transparent",
445
448
  style: inputStyles,
446
449
  ...rest,
450
+ ...this.state.nativeProps,
447
451
  value: this.state.value
448
452
  })), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
449
453
  name: rightIconName,
@@ -16,4 +16,4 @@ const APPROX_STATUSBAR_HEIGHT = _reactNative.Platform.select({
16
16
  ios: _reactNative.Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
17
17
  });
18
18
 
19
- exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;
19
+ exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;AR_HEIGHT;
@@ -16,7 +16,6 @@ const SEED_DATA = {
16
16
  height: 300,
17
17
  width: "100%"
18
18
  },
19
- triggers: [_types.Triggers.OnIndexChanged],
20
19
  props: {
21
20
  from: (0, _types.createNumberProp)({
22
21
  group: _types.GROUPS.basic,
@@ -24,7 +24,7 @@ const SEED_DATA_PROPS = {
24
24
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
25
25
  editable: true,
26
26
  required: false,
27
- defaultValue: null,
27
+ defaultValue: "none",
28
28
  options: ["none", "sentences", "words", "characters"],
29
29
  formType: _types.FORM_TYPES.flatArray,
30
30
  propType: _types.PROP_TYPES.STRING
@@ -103,7 +103,7 @@ const SEED_DATA = [{
103
103
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
104
104
  editable: true,
105
105
  required: false,
106
- defaultValue: null,
106
+ defaultValue: "none",
107
107
  options: ["none", "sentences", "words", "characters"],
108
108
  formType: _types.FORM_TYPES.flatArray,
109
109
  propType: _types.PROP_TYPES.STRING
@@ -261,7 +261,6 @@ const Picker = _ref => {
261
261
  );
262
262
  };
263
263
 
264
- export default withTheme(Picker);
265
264
  const styles = StyleSheet.create({
266
265
  marginsContainer: {
267
266
  alignSelf: "stretch",
@@ -331,4 +330,5 @@ const styles = StyleSheet.create({
331
330
  maxWidth: deviceWidth,
332
331
  maxHeight: deviceHeight
333
332
  }
334
- });
333
+ });
334
+ export default withTheme(Picker);
@@ -19,7 +19,6 @@ const Swiper = _ref => {
19
19
  keyExtractor,
20
20
  renderItem,
21
21
  children,
22
- onIndexChanged,
23
22
  style
24
23
  } = _ref;
25
24
  return /*#__PURE__*/React.createElement(View, {
@@ -29,7 +28,6 @@ const Swiper = _ref => {
29
28
  loop: loop,
30
29
  timeout: timeout,
31
30
  vertical: vertical,
32
- onIndexChanged: onIndexChanged,
33
31
  controlsProps: {
34
32
  prevTitle,
35
33
  nextTitle,
@@ -11,10 +11,14 @@ class Text extends React.Component {
11
11
  super(...arguments);
12
12
 
13
13
  _defineProperty(this, "_root", void 0);
14
+
15
+ _defineProperty(this, "state", {
16
+ nativeProps: {}
17
+ });
14
18
  }
15
19
 
16
20
  setNativeProps(args) {
17
- return this._root && this._root.setNativeProps(args);
21
+ this.state.nativeProps = args || {};
18
22
  }
19
23
 
20
24
  render() {
@@ -23,7 +27,7 @@ class Text extends React.Component {
23
27
  ...rest
24
28
  } = this.props;
25
29
  const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
26
- return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, {
30
+ return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, this.state.nativeProps, {
27
31
  ref: c => {
28
32
  this._root = c;
29
33
  },
@@ -16,6 +16,7 @@ class TextField extends React.Component {
16
16
  super(...arguments);
17
17
 
18
18
  _defineProperty(this, "state", {
19
+ nativeProps: {},
19
20
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
20
21
  focused: false,
21
22
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -146,7 +147,9 @@ class TextField extends React.Component {
146
147
  * @internal
147
148
  */
148
149
  setNativeProps(args) {
149
- return this._root && this._root.setNativeProps(args);
150
+ this.setState(state => ({ ...state,
151
+ nativeState: args || {}
152
+ }));
150
153
  }
151
154
 
152
155
  isFocused() {
@@ -426,6 +429,7 @@ class TextField extends React.Component {
426
429
  underlineColorAndroid: "transparent",
427
430
  style: inputStyles,
428
431
  ...rest,
432
+ ...this.state.nativeProps,
429
433
  value: this.state.value
430
434
  })), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
431
435
  name: rightIconName,
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, Triggers } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Swiper",
4
4
  tag: "Swiper",
@@ -8,7 +8,6 @@ export const SEED_DATA = {
8
8
  height: 300,
9
9
  width: "100%"
10
10
  },
11
- triggers: [Triggers.OnIndexChanged],
12
11
  props: {
13
12
  from: createNumberProp({
14
13
  group: GROUPS.basic,
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
16
16
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
17
17
  editable: true,
18
18
  required: false,
19
- defaultValue: null,
19
+ defaultValue: "none",
20
20
  options: ["none", "sentences", "words", "characters"],
21
21
  formType: FORM_TYPES.flatArray,
22
22
  propType: PROP_TYPES.STRING
@@ -94,7 +94,7 @@ export const SEED_DATA = [{
94
94
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
95
95
  editable: true,
96
96
  required: false,
97
- defaultValue: null,
97
+ defaultValue: "none",
98
98
  options: ["none", "sentences", "words", "characters"],
99
99
  formType: FORM_TYPES.flatArray,
100
100
  propType: PROP_TYPES.STRING
@@ -20,7 +20,6 @@ export interface SwiperProps<T> {
20
20
  index: number;
21
21
  }) => JSX.Element;
22
22
  style?: StyleProp<ViewStyle>;
23
- onIndexChanged?: (index: number) => void;
24
23
  }
25
- declare const Swiper: ({ vertical, loop, timeout, from, prevTitle, nextTitle, prevTitleColor, nextTitleColor, dotsTouchable, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, onIndexChanged, style, }: SwiperProps<any>) => JSX.Element;
24
+ declare const Swiper: ({ vertical, loop, timeout, from, prevTitle, nextTitle, prevTitleColor, nextTitleColor, dotsTouchable, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, style, }: SwiperProps<any>) => JSX.Element;
26
25
  export default Swiper;
@@ -6,7 +6,8 @@ declare type Props = {
6
6
  } & TextProps;
7
7
  declare class Text extends React.Component<Props> {
8
8
  _root: any;
9
- setNativeProps(args: TextProps): any;
9
+ state: any;
10
+ setNativeProps(args: TextProps): void;
10
11
  render(): JSX.Element;
11
12
  }
12
13
  export declare const BaseLink: ({ style, theme, title, ...props }: any) => JSX.Element;
@@ -27,6 +27,7 @@ export declare type Props = {
27
27
  }) => React.ReactNode;
28
28
  } & TextInputProps & IconSlot;
29
29
  interface State {
30
+ nativeProps: any;
30
31
  labeled: Animated.Value;
31
32
  focused?: boolean;
32
33
  placeholder?: string | undefined;
@@ -57,7 +58,7 @@ declare class TextField extends React.Component<Props, State> {
57
58
  /**
58
59
  * @internal
59
60
  */
60
- setNativeProps(args: Props): void | undefined;
61
+ setNativeProps(args: Props): void;
61
62
  isFocused(): boolean | undefined;
62
63
  clear(): void | undefined;
63
64
  focus(): void | undefined;
@@ -7,7 +7,6 @@ export declare const SEED_DATA: {
7
7
  height: number;
8
8
  width: string;
9
9
  };
10
- triggers: string[];
11
10
  props: {
12
11
  from: {
13
12
  label: string;
@@ -64,7 +64,7 @@ export declare const SEED_DATA: ({
64
64
  description: string;
65
65
  editable: boolean;
66
66
  required: boolean;
67
- defaultValue: null;
67
+ defaultValue: string;
68
68
  options: string[];
69
69
  formType: string;
70
70
  propType: string;
@@ -371,7 +371,7 @@ export declare const SEED_DATA: ({
371
371
  description: string;
372
372
  editable: boolean;
373
373
  required: boolean;
374
- defaultValue: null;
374
+ defaultValue: string;
375
375
  options: string[];
376
376
  formType: string;
377
377
  propType: string;
@@ -229,7 +229,7 @@ export declare const SEED_DATA: {
229
229
  description: string;
230
230
  editable: boolean;
231
231
  required: boolean;
232
- defaultValue: null;
232
+ defaultValue: string;
233
233
  options: string[];
234
234
  formType: string;
235
235
  propType: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.4.4-41266b.2+41266b0",
3
+ "version": "46.4.4-5206b0.2+5206b00",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.4.4-41266b.2+41266b0",
44
+ "@draftbit/types": "^46.4.4-5206b0.2+5206b00",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -81,5 +81,5 @@
81
81
  ]
82
82
  ]
83
83
  },
84
- "gitHead": "41266b08b3e00b6122fff95a93f5e9e9084a36c6"
84
+ "gitHead": "5206b0041de0cb36f5211e9bac66c4b94fdbb594"
85
85
  }
@@ -194,7 +194,6 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
194
194
  React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
195
195
  !isIos && pickerVisible ? (React.createElement(NativePicker, { enabled: pickerVisible, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker, ref: androidPickerRef, onBlur: () => setPickerVisible(false) }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
196
196
  };
197
- export default withTheme(Picker);
198
197
  const styles = StyleSheet.create({
199
198
  marginsContainer: {
200
199
  alignSelf: "stretch",
@@ -265,3 +264,4 @@ const styles = StyleSheet.create({
265
264
  maxHeight: deviceHeight,
266
265
  },
267
266
  });
267
+ export default withTheme(Picker);
@@ -406,8 +406,6 @@ const Picker: React.FC<PickerProps> = ({
406
406
  );
407
407
  };
408
408
 
409
- export default withTheme(Picker);
410
-
411
409
  const styles = StyleSheet.create({
412
410
  marginsContainer: {
413
411
  alignSelf: "stretch",
@@ -478,3 +476,5 @@ const styles = StyleSheet.create({
478
476
  maxHeight: deviceHeight,
479
477
  },
480
478
  });
479
+
480
+ export default withTheme(Picker);
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { View } from "react-native";
3
3
  import SwiperComponent from "react-native-web-swiper";
4
- const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, onIndexChanged, style, }) => (React.createElement(View, { style: style },
5
- React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, onIndexChanged: onIndexChanged, controlsProps: {
4
+ const Swiper = ({ vertical = false, loop = false, timeout = 0, from = 0, prevTitle = "", nextTitle = "", prevTitleColor, nextTitleColor, dotsTouchable = true, dotColor, dotActiveColor, data, keyExtractor, renderItem, children, style, }) => (React.createElement(View, { style: style },
5
+ React.createElement(SwiperComponent, { from: from, loop: loop, timeout: timeout, vertical: vertical, controlsProps: {
6
6
  prevTitle,
7
7
  nextTitle,
8
8
  prevTitleStyle: { color: prevTitleColor },
@@ -19,7 +19,6 @@ export interface SwiperProps<T> {
19
19
  keyExtractor: (item: T, index: number) => string;
20
20
  renderItem?: ({ item, index }: { item: T; index: number }) => JSX.Element;
21
21
  style?: StyleProp<ViewStyle>;
22
- onIndexChanged?: (index: number) => void;
23
22
  }
24
23
 
25
24
  const Swiper = ({
@@ -38,7 +37,6 @@ const Swiper = ({
38
37
  keyExtractor,
39
38
  renderItem,
40
39
  children,
41
- onIndexChanged,
42
40
  style,
43
41
  }: SwiperProps<any>) => (
44
42
  <View style={style}>
@@ -48,7 +46,6 @@ const Swiper = ({
48
46
  loop={loop}
49
47
  timeout={timeout}
50
48
  vertical={vertical}
51
- onIndexChanged={onIndexChanged}
52
49
  controlsProps={{
53
50
  prevTitle,
54
51
  nextTitle,
@@ -2,13 +2,19 @@ import * as React from "react";
2
2
  import { Text as NativeText, I18nManager } from "react-native";
3
3
  import { withTheme } from "../theming";
4
4
  class Text extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.state = {
8
+ nativeProps: {},
9
+ };
10
+ }
5
11
  setNativeProps(args) {
6
- return this._root && this._root.setNativeProps(args);
12
+ this.state.nativeProps = args || {};
7
13
  }
8
14
  render() {
9
15
  const { style, ...rest } = this.props;
10
16
  const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
11
- return (React.createElement(NativeText, { ...rest, ref: (c) => {
17
+ return (React.createElement(NativeText, { ...rest, ...this.state.nativeProps, ref: (c) => {
12
18
  this._root = c;
13
19
  }, style: [
14
20
  {
@@ -10,8 +10,12 @@ type Props = {
10
10
  class Text extends React.Component<Props> {
11
11
  _root: any;
12
12
 
13
+ state: any = {
14
+ nativeProps: {},
15
+ };
16
+
13
17
  setNativeProps(args: TextProps) {
14
- return this._root && this._root.setNativeProps(args);
18
+ this.state.nativeProps = args || {};
15
19
  }
16
20
 
17
21
  render() {
@@ -21,6 +25,7 @@ class Text extends React.Component<Props> {
21
25
  return (
22
26
  <NativeText
23
27
  {...rest}
28
+ {...this.state.nativeProps}
24
29
  ref={(c) => {
25
30
  this._root = c;
26
31
  }}
@@ -10,6 +10,7 @@ class TextField extends React.Component {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  this.state = {
13
+ nativeProps: {},
13
14
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
14
15
  focused: false,
15
16
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -121,7 +122,10 @@ class TextField extends React.Component {
121
122
  * @internal
122
123
  */
123
124
  setNativeProps(args) {
124
- return this._root && this._root.setNativeProps(args);
125
+ this.setState((state) => ({
126
+ ...state,
127
+ nativeState: args || {},
128
+ }));
125
129
  }
126
130
  isFocused() {
127
131
  return this._root && this._root.isFocused();
@@ -381,6 +385,7 @@ class TextField extends React.Component {
381
385
  underlineColorAndroid: "transparent",
382
386
  style: inputStyles,
383
387
  ...rest,
388
+ ...this.state.nativeProps,
384
389
  value: this.state.value,
385
390
  })),
386
391
  rightIconName ? (React.createElement(Icon, { name: rightIconName, size: ICON_SIZE, color: colors.light, style: {
@@ -52,6 +52,7 @@ export type Props = {
52
52
  IconSlot;
53
53
 
54
54
  interface State {
55
+ nativeProps: any;
55
56
  labeled: Animated.Value;
56
57
  focused?: boolean;
57
58
  placeholder?: string | undefined;
@@ -73,6 +74,7 @@ class TextField extends React.Component<Props, State> {
73
74
  }
74
75
 
75
76
  state: State = {
77
+ nativeProps: {},
76
78
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
77
79
  focused: false,
78
80
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -207,7 +209,10 @@ class TextField extends React.Component<Props, State> {
207
209
  * @internal
208
210
  */
209
211
  setNativeProps(args: Props) {
210
- return this._root && this._root.setNativeProps(args);
212
+ this.setState((state) => ({
213
+ ...state,
214
+ nativeState: args || {},
215
+ }));
211
216
  }
212
217
 
213
218
  isFocused() {
@@ -566,6 +571,7 @@ class TextField extends React.Component<Props, State> {
566
571
  underlineColorAndroid: "transparent",
567
572
  style: inputStyles,
568
573
  ...rest,
574
+ ...this.state.nativeProps,
569
575
  value: this.state.value,
570
576
  })}
571
577
  </View>
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, Triggers, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createBoolProp, createNumberProp, createTextProp, createColorProp, GROUPS, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Swiper",
4
4
  tag: "Swiper",
@@ -8,7 +8,6 @@ export const SEED_DATA = {
8
8
  height: 300,
9
9
  width: "100%",
10
10
  },
11
- triggers: [Triggers.OnIndexChanged],
12
11
  props: {
13
12
  from: createNumberProp({
14
13
  group: GROUPS.basic,
@@ -5,7 +5,6 @@ import {
5
5
  createTextProp,
6
6
  createColorProp,
7
7
  GROUPS,
8
- Triggers,
9
8
  } from "@draftbit/types";
10
9
 
11
10
  export const SEED_DATA = {
@@ -17,7 +16,6 @@ export const SEED_DATA = {
17
16
  height: 300,
18
17
  width: "100%",
19
18
  },
20
- triggers: [Triggers.OnIndexChanged],
21
19
  props: {
22
20
  from: createNumberProp({
23
21
  group: GROUPS.basic,
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
16
16
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
17
17
  editable: true,
18
18
  required: false,
19
- defaultValue: null,
19
+ defaultValue: "none",
20
20
  options: ["none", "sentences", "words", "characters"],
21
21
  formType: FORM_TYPES.flatArray,
22
22
  propType: PROP_TYPES.STRING,
@@ -30,7 +30,7 @@ const SEED_DATA_PROPS = {
30
30
  "Can automatically capitalize sentences, words, and characters (Default: none).",
31
31
  editable: true,
32
32
  required: false,
33
- defaultValue: null,
33
+ defaultValue: "none",
34
34
  options: ["none", "sentences", "words", "characters"],
35
35
  formType: FORM_TYPES.flatArray,
36
36
  propType: PROP_TYPES.STRING,
@@ -104,7 +104,7 @@ export const SEED_DATA = [
104
104
  description: "Can automatically capitalize sentences, words, and characters (Default: none).",
105
105
  editable: true,
106
106
  required: false,
107
- defaultValue: null,
107
+ defaultValue: "none",
108
108
  options: ["none", "sentences", "words", "characters"],
109
109
  formType: FORM_TYPES.flatArray,
110
110
  propType: PROP_TYPES.STRING,
@@ -121,7 +121,7 @@ export const SEED_DATA = [
121
121
  "Can automatically capitalize sentences, words, and characters (Default: none).",
122
122
  editable: true,
123
123
  required: false,
124
- defaultValue: null,
124
+ defaultValue: "none",
125
125
  options: ["none", "sentences", "words", "characters"],
126
126
  formType: FORM_TYPES.flatArray,
127
127
  propType: PROP_TYPES.STRING,