@hero-design/rn 8.45.0 → 8.45.2-test-only.0

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.
@@ -4,5 +4,5 @@ $ rollup -c
4
4
  src/index.ts → lib/index.js, es/index.js...
5
5
  (!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
6
6
  (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/runner/_work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
7
- created lib/index.js, es/index.js in 29.7s
7
+ created lib/index.js, es/index.js in 28.2s
8
8
  $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.45.2-test-only.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2406](https://github.com/Thinkei/hero-design/pull/2406) [`f6a11c2a9`](https://github.com/Thinkei/hero-design/commit/f6a11c2a97133154a527f607f3af59a5a7e30b3c) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [PageControl] Fix animation not working
8
+
9
+ ## 8.45.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#2399](https://github.com/Thinkei/hero-design/pull/2399) [`9c30d8876`](https://github.com/Thinkei/hero-design/commit/9c30d88766b22e19eafc02322cc6b4af284a14c0) Thanks [@luanlai2201](https://github.com/luanlai2201)! - [TextInput] [RichTextEditor] Fix label position if width is small
14
+
15
+ - [#2390](https://github.com/Thinkei/hero-design/pull/2390) [`8c7780262`](https://github.com/Thinkei/hero-design/commit/8c77802626e1069a50b8cf54c0ff36722f5a248f) Thanks [@ttkien](https://github.com/ttkien)! - Upgrade dependencies to the versions which suggested by expo@48
16
+
17
+ - Updated dependencies [[`8c7780262`](https://github.com/Thinkei/hero-design/commit/8c77802626e1069a50b8cf54c0ff36722f5a248f)]:
18
+ - @hero-design/react-native-month-year-picker@8.42.6
19
+
3
20
  ## 8.45.0
4
21
 
5
22
  ### Minor Changes
package/es/index.js CHANGED
@@ -11947,7 +11947,10 @@ var PageControl = function PageControl(_ref) {
11947
11947
  var theme = useTheme();
11948
11948
  var animatedValue = React.useRef(new Animated.Value(currentPage)).current;
11949
11949
  React.useEffect(function () {
11950
- animatedValue.setValue(currentPage);
11950
+ Animated.spring(animatedValue, {
11951
+ toValue: currentPage,
11952
+ useNativeDriver: Platform.OS !== 'web'
11953
+ }).start();
11951
11954
  }, [currentPage]);
11952
11955
  return /*#__PURE__*/React.createElement(StyledPageControl$2, {
11953
11956
  testID: testID,
@@ -12676,9 +12679,10 @@ var StyledLabelContainerInsideTextInput = index$a(Animated.View)(function (_ref2
12676
12679
  return {
12677
12680
  flexDirection: 'row',
12678
12681
  alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
12682
+ justifyContent: 'center',
12679
12683
  position: 'absolute',
12680
12684
  zIndex: 1,
12681
- left: -theme.__hd__.textInput.space.labelLeft,
12685
+ left: 0,
12682
12686
  right: 0,
12683
12687
  top: -theme.__hd__.textInput.space.labelTop
12684
12688
  };
@@ -12848,18 +12852,25 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
12848
12852
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
12849
12853
  var isEmptyValue = displayText.length === 0;
12850
12854
  var actualSuffix = loading ? 'loading' : suffix;
12851
- var _React$useState = React.useState(0),
12855
+ var _React$useState = React.useState({
12856
+ height: 0,
12857
+ width: 0
12858
+ }),
12852
12859
  _React$useState2 = _slicedToArray(_React$useState, 2),
12853
- inputHeight = _React$useState2[0],
12854
- setInputHeight = _React$useState2[1];
12860
+ inputSize = _React$useState2[0],
12861
+ setInputSize = _React$useState2[1];
12855
12862
  var _React$useState3 = React.useState(0),
12856
12863
  _React$useState4 = _slicedToArray(_React$useState3, 2),
12857
- prefixWidth = _React$useState4[0],
12858
- setPrefixWidth = _React$useState4[1];
12859
- var _React$useState5 = React.useState(false),
12864
+ labelWidth = _React$useState4[0],
12865
+ setLabelWidth = _React$useState4[1];
12866
+ var _React$useState5 = React.useState(0),
12860
12867
  _React$useState6 = _slicedToArray(_React$useState5, 2),
12861
- isFocused = _React$useState6[0],
12862
- setIsFocused = _React$useState6[1];
12868
+ prefixWidth = _React$useState6[0],
12869
+ setPrefixWidth = _React$useState6[1];
12870
+ var _React$useState7 = React.useState(false),
12871
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
12872
+ isFocused = _React$useState8[0],
12873
+ setIsFocused = _React$useState8[1];
12863
12874
  var state = getState$1({
12864
12875
  disabled: disabled,
12865
12876
  error: error,
@@ -12880,13 +12891,24 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
12880
12891
  }).start();
12881
12892
  }, [focusAnimation, isEmptyValue, isFocused]);
12882
12893
  var onLayout = useCallback(function (event) {
12883
- var height = event.nativeEvent.layout.height;
12884
- setInputHeight(height);
12894
+ var _event$nativeEvent$la = event.nativeEvent.layout,
12895
+ height = _event$nativeEvent$la.height,
12896
+ width = _event$nativeEvent$la.width;
12897
+ setInputSize(function (prev) {
12898
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
12899
+ height: height,
12900
+ width: width
12901
+ });
12902
+ });
12885
12903
  }, []);
12886
12904
  var onPrefixLayout = useCallback(function (event) {
12887
12905
  var width = event.nativeEvent.layout.width;
12888
12906
  setPrefixWidth(width);
12889
12907
  }, []);
12908
+ var onLabelLayout = useCallback(function (event) {
12909
+ var width = event.nativeEvent.layout.width;
12910
+ setLabelWidth(width);
12911
+ }, []);
12890
12912
  var innerTextInput = React.useRef();
12891
12913
  React.useImperativeHandle(ref, function () {
12892
12914
  return {
@@ -13009,12 +13031,12 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
13009
13031
  transform: [{
13010
13032
  translateY: focusAnimation.interpolate({
13011
13033
  inputRange: [0, 1],
13012
- outputRange: [variant !== 'textarea' ? inputHeight / 2 : theme.space.large, 0]
13034
+ outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, 0]
13013
13035
  })
13014
13036
  }, {
13015
13037
  translateX: focusAnimation.interpolate({
13016
13038
  inputRange: [0, 1],
13017
- outputRange: [prefix ? prefixWidth * 4 : theme.space.xxxlarge, 0]
13039
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + prefixWidth + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
13018
13040
  })
13019
13041
  }, {
13020
13042
  scale: focusAnimation.interpolate({
@@ -13035,7 +13057,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
13035
13057
  },
13036
13058
  nativeID: accessibilityLabelledBy,
13037
13059
  testID: "input-label",
13038
- themeState: state
13060
+ themeState: state,
13061
+ onLayout: onLabelLayout
13039
13062
  }, label)), /*#__PURE__*/React.createElement(StyledTextInputAndLabelContainer, null, renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
13040
13063
  themeVariant: variant,
13041
13064
  multiline: variant === 'textarea' || nativeProps.multiline,
@@ -34031,10 +34054,17 @@ var RichTextEditor = function RichTextEditor(_ref) {
34031
34054
  postMessage(webview.current, message);
34032
34055
  }
34033
34056
  };
34034
- var _React$useState = React.useState(0),
34057
+ var _React$useState = React.useState({
34058
+ height: 0,
34059
+ width: 0
34060
+ }),
34035
34061
  _React$useState2 = _slicedToArray(_React$useState, 2),
34036
- inputHeight = _React$useState2[0],
34037
- setInputHeight = _React$useState2[1];
34062
+ inputSize = _React$useState2[0],
34063
+ setInputSize = _React$useState2[1];
34064
+ var _React$useState3 = React.useState(0),
34065
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
34066
+ labelWidth = _React$useState4[0],
34067
+ setLabelWidth = _React$useState4[1];
34038
34068
  var focusAnimation = useRef(new Animated.Value(0)).current;
34039
34069
  useEffect(function () {
34040
34070
  Animated.timing(focusAnimation, {
@@ -34045,8 +34075,19 @@ var RichTextEditor = function RichTextEditor(_ref) {
34045
34075
  }).start();
34046
34076
  }, [focusAnimation, isEmptyValue, isFocused]);
34047
34077
  var onLayout = useCallback(function (event) {
34048
- var height = event.nativeEvent.layout.height;
34049
- setInputHeight(height);
34078
+ var _event$nativeEvent$la = event.nativeEvent.layout,
34079
+ height = _event$nativeEvent$la.height,
34080
+ width = _event$nativeEvent$la.width;
34081
+ setInputSize(function (prev) {
34082
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
34083
+ height: height,
34084
+ width: width
34085
+ });
34086
+ });
34087
+ }, []);
34088
+ var onLabelLayout = useCallback(function (event) {
34089
+ var width = event.nativeEvent.layout.width;
34090
+ setLabelWidth(width);
34050
34091
  }, []);
34051
34092
  useEffect(function () {
34052
34093
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
@@ -34147,12 +34188,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
34147
34188
  transform: [{
34148
34189
  translateY: focusAnimation.interpolate({
34149
34190
  inputRange: [0, 1],
34150
- outputRange: [inputHeight / 2, 0]
34191
+ outputRange: [inputSize.height / 2, 0]
34151
34192
  })
34152
34193
  }, {
34153
34194
  translateX: focusAnimation.interpolate({
34154
34195
  inputRange: [0, 1],
34155
- outputRange: [theme.space.xxxlarge, 0]
34196
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
34156
34197
  })
34157
34198
  }, {
34158
34199
  scale: focusAnimation.interpolate({
@@ -34171,7 +34212,8 @@ var RichTextEditor = function RichTextEditor(_ref) {
34171
34212
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
34172
34213
  },
34173
34214
  testID: "input-label",
34174
- themeState: state
34215
+ themeState: state,
34216
+ onLayout: onLabelLayout
34175
34217
  }, label)), /*#__PURE__*/React.createElement(StyledTextInputContainer, {
34176
34218
  onLayout: onLayout
34177
34219
  }, /*#__PURE__*/React.createElement(StyledBorderBackDrop, {
package/lib/index.js CHANGED
@@ -11977,7 +11977,10 @@ var PageControl = function PageControl(_ref) {
11977
11977
  var theme = useTheme();
11978
11978
  var animatedValue = React__default["default"].useRef(new reactNative.Animated.Value(currentPage)).current;
11979
11979
  React__default["default"].useEffect(function () {
11980
- animatedValue.setValue(currentPage);
11980
+ reactNative.Animated.spring(animatedValue, {
11981
+ toValue: currentPage,
11982
+ useNativeDriver: reactNative.Platform.OS !== 'web'
11983
+ }).start();
11981
11984
  }, [currentPage]);
11982
11985
  return /*#__PURE__*/React__default["default"].createElement(StyledPageControl$2, {
11983
11986
  testID: testID,
@@ -12706,9 +12709,10 @@ var StyledLabelContainerInsideTextInput = index$a(reactNative.Animated.View)(fun
12706
12709
  return {
12707
12710
  flexDirection: 'row',
12708
12711
  alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
12712
+ justifyContent: 'center',
12709
12713
  position: 'absolute',
12710
12714
  zIndex: 1,
12711
- left: -theme.__hd__.textInput.space.labelLeft,
12715
+ left: 0,
12712
12716
  right: 0,
12713
12717
  top: -theme.__hd__.textInput.space.labelTop
12714
12718
  };
@@ -12878,18 +12882,25 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
12878
12882
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
12879
12883
  var isEmptyValue = displayText.length === 0;
12880
12884
  var actualSuffix = loading ? 'loading' : suffix;
12881
- var _React$useState = React__default["default"].useState(0),
12885
+ var _React$useState = React__default["default"].useState({
12886
+ height: 0,
12887
+ width: 0
12888
+ }),
12882
12889
  _React$useState2 = _slicedToArray(_React$useState, 2),
12883
- inputHeight = _React$useState2[0],
12884
- setInputHeight = _React$useState2[1];
12890
+ inputSize = _React$useState2[0],
12891
+ setInputSize = _React$useState2[1];
12885
12892
  var _React$useState3 = React__default["default"].useState(0),
12886
12893
  _React$useState4 = _slicedToArray(_React$useState3, 2),
12887
- prefixWidth = _React$useState4[0],
12888
- setPrefixWidth = _React$useState4[1];
12889
- var _React$useState5 = React__default["default"].useState(false),
12894
+ labelWidth = _React$useState4[0],
12895
+ setLabelWidth = _React$useState4[1];
12896
+ var _React$useState5 = React__default["default"].useState(0),
12890
12897
  _React$useState6 = _slicedToArray(_React$useState5, 2),
12891
- isFocused = _React$useState6[0],
12892
- setIsFocused = _React$useState6[1];
12898
+ prefixWidth = _React$useState6[0],
12899
+ setPrefixWidth = _React$useState6[1];
12900
+ var _React$useState7 = React__default["default"].useState(false),
12901
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
12902
+ isFocused = _React$useState8[0],
12903
+ setIsFocused = _React$useState8[1];
12893
12904
  var state = getState$1({
12894
12905
  disabled: disabled,
12895
12906
  error: error,
@@ -12910,13 +12921,24 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
12910
12921
  }).start();
12911
12922
  }, [focusAnimation, isEmptyValue, isFocused]);
12912
12923
  var onLayout = React.useCallback(function (event) {
12913
- var height = event.nativeEvent.layout.height;
12914
- setInputHeight(height);
12924
+ var _event$nativeEvent$la = event.nativeEvent.layout,
12925
+ height = _event$nativeEvent$la.height,
12926
+ width = _event$nativeEvent$la.width;
12927
+ setInputSize(function (prev) {
12928
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
12929
+ height: height,
12930
+ width: width
12931
+ });
12932
+ });
12915
12933
  }, []);
12916
12934
  var onPrefixLayout = React.useCallback(function (event) {
12917
12935
  var width = event.nativeEvent.layout.width;
12918
12936
  setPrefixWidth(width);
12919
12937
  }, []);
12938
+ var onLabelLayout = React.useCallback(function (event) {
12939
+ var width = event.nativeEvent.layout.width;
12940
+ setLabelWidth(width);
12941
+ }, []);
12920
12942
  var innerTextInput = React__default["default"].useRef();
12921
12943
  React__default["default"].useImperativeHandle(ref, function () {
12922
12944
  return {
@@ -13039,12 +13061,12 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13039
13061
  transform: [{
13040
13062
  translateY: focusAnimation.interpolate({
13041
13063
  inputRange: [0, 1],
13042
- outputRange: [variant !== 'textarea' ? inputHeight / 2 : theme.space.large, 0]
13064
+ outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, 0]
13043
13065
  })
13044
13066
  }, {
13045
13067
  translateX: focusAnimation.interpolate({
13046
13068
  inputRange: [0, 1],
13047
- outputRange: [prefix ? prefixWidth * 4 : theme.space.xxxlarge, 0]
13069
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + prefixWidth + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
13048
13070
  })
13049
13071
  }, {
13050
13072
  scale: focusAnimation.interpolate({
@@ -13065,7 +13087,8 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13065
13087
  },
13066
13088
  nativeID: accessibilityLabelledBy,
13067
13089
  testID: "input-label",
13068
- themeState: state
13090
+ themeState: state,
13091
+ onLayout: onLabelLayout
13069
13092
  }, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputAndLabelContainer, null, renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
13070
13093
  themeVariant: variant,
13071
13094
  multiline: variant === 'textarea' || nativeProps.multiline,
@@ -34061,10 +34084,17 @@ var RichTextEditor = function RichTextEditor(_ref) {
34061
34084
  postMessage(webview.current, message);
34062
34085
  }
34063
34086
  };
34064
- var _React$useState = React__default["default"].useState(0),
34087
+ var _React$useState = React__default["default"].useState({
34088
+ height: 0,
34089
+ width: 0
34090
+ }),
34065
34091
  _React$useState2 = _slicedToArray(_React$useState, 2),
34066
- inputHeight = _React$useState2[0],
34067
- setInputHeight = _React$useState2[1];
34092
+ inputSize = _React$useState2[0],
34093
+ setInputSize = _React$useState2[1];
34094
+ var _React$useState3 = React__default["default"].useState(0),
34095
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
34096
+ labelWidth = _React$useState4[0],
34097
+ setLabelWidth = _React$useState4[1];
34068
34098
  var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
34069
34099
  React.useEffect(function () {
34070
34100
  reactNative.Animated.timing(focusAnimation, {
@@ -34075,8 +34105,19 @@ var RichTextEditor = function RichTextEditor(_ref) {
34075
34105
  }).start();
34076
34106
  }, [focusAnimation, isEmptyValue, isFocused]);
34077
34107
  var onLayout = React.useCallback(function (event) {
34078
- var height = event.nativeEvent.layout.height;
34079
- setInputHeight(height);
34108
+ var _event$nativeEvent$la = event.nativeEvent.layout,
34109
+ height = _event$nativeEvent$la.height,
34110
+ width = _event$nativeEvent$la.width;
34111
+ setInputSize(function (prev) {
34112
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
34113
+ height: height,
34114
+ width: width
34115
+ });
34116
+ });
34117
+ }, []);
34118
+ var onLabelLayout = React.useCallback(function (event) {
34119
+ var width = event.nativeEvent.layout.width;
34120
+ setLabelWidth(width);
34080
34121
  }, []);
34081
34122
  React.useEffect(function () {
34082
34123
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
@@ -34177,12 +34218,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
34177
34218
  transform: [{
34178
34219
  translateY: focusAnimation.interpolate({
34179
34220
  inputRange: [0, 1],
34180
- outputRange: [inputHeight / 2, 0]
34221
+ outputRange: [inputSize.height / 2, 0]
34181
34222
  })
34182
34223
  }, {
34183
34224
  translateX: focusAnimation.interpolate({
34184
34225
  inputRange: [0, 1],
34185
- outputRange: [theme.space.xxxlarge, 0]
34226
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
34186
34227
  })
34187
34228
  }, {
34188
34229
  scale: focusAnimation.interpolate({
@@ -34201,7 +34242,8 @@ var RichTextEditor = function RichTextEditor(_ref) {
34201
34242
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
34202
34243
  },
34203
34244
  testID: "input-label",
34204
- themeState: state
34245
+ themeState: state,
34246
+ onLayout: onLabelLayout
34205
34247
  }, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, {
34206
34248
  onLayout: onLayout
34207
34249
  }, /*#__PURE__*/React__default["default"].createElement(StyledBorderBackDrop, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.45.0",
3
+ "version": "8.45.2-test-only.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -28,11 +28,11 @@
28
28
  "nanoid": "^4.0.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@hero-design/react-native-month-year-picker": "^8.42.5",
31
+ "@hero-design/react-native-month-year-picker": "^8.42.6",
32
32
  "@react-native-community/datetimepicker": "^3.5.2",
33
33
  "@react-native-community/slider": "4.4.3",
34
34
  "react": "18.2.0",
35
- "react-native": "0.71.13",
35
+ "react-native": "^0.71.0",
36
36
  "react-native-gesture-handler": "^1.10.3 | ~2.5.0",
37
37
  "react-native-linear-gradient": "^2.6.2",
38
38
  "react-native-pager-view": "^5.4.25",
@@ -48,8 +48,8 @@
48
48
  "@babel/runtime": "^7.20.0",
49
49
  "@emotion/jest": "^11.11.0",
50
50
  "@hero-design/eslint-plugin": "8.42.5",
51
- "@hero-design/react-native-month-year-picker": "^8.42.5",
52
- "@react-native-community/datetimepicker": "^3.5.2",
51
+ "@hero-design/react-native-month-year-picker": "^8.42.6",
52
+ "@react-native-community/datetimepicker": "3.5.2",
53
53
  "@react-native-community/slider": "4.4.3",
54
54
  "@rollup/plugin-babel": "^5.3.1",
55
55
  "@rollup/plugin-commonjs": "^21.0.1",
@@ -71,7 +71,7 @@
71
71
  "jest-junit": "^16.0.0",
72
72
  "prettier-config-hd": "8.42.4",
73
73
  "react": "18.2.0",
74
- "react-native": "0.71.13",
74
+ "react-native": "0.71.14",
75
75
  "react-native-gesture-handler": "~2.5.0",
76
76
  "react-native-linear-gradient": "^2.6.2",
77
77
  "react-native-pager-view": "^5.4.25",
@@ -108,7 +108,8 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
108
108
  {
109
109
  "alignItems": "center",
110
110
  "flexDirection": "row",
111
- "left": -32,
111
+ "justifyContent": "center",
112
+ "left": 0,
112
113
  "position": "absolute",
113
114
  "right": 0,
114
115
  "top": -10.666666666666666,
@@ -117,7 +118,7 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
117
118
  "translateY": 0,
118
119
  },
119
120
  {
120
- "translateX": 48,
121
+ "translateX": 24,
121
122
  },
122
123
  {
123
124
  "scale": 1,
@@ -130,6 +131,7 @@ exports[`DatePicker renders DatePickerAndroid when OS is android 1`] = `
130
131
  >
131
132
  <Text
132
133
  allowFontScaling={false}
134
+ onLayout={[Function]}
133
135
  style={
134
136
  [
135
137
  {
@@ -386,7 +388,8 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
386
388
  {
387
389
  "alignItems": "center",
388
390
  "flexDirection": "row",
389
- "left": -32,
391
+ "justifyContent": "center",
392
+ "left": 0,
390
393
  "position": "absolute",
391
394
  "right": 0,
392
395
  "top": -10.666666666666666,
@@ -395,7 +398,7 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
395
398
  "translateY": 0,
396
399
  },
397
400
  {
398
- "translateX": 48,
401
+ "translateX": 24,
399
402
  },
400
403
  {
401
404
  "scale": 1,
@@ -408,6 +411,7 @@ exports[`DatePicker renders DatePickerIOS when OS is iOS 1`] = `
408
411
  >
409
412
  <Text
410
413
  allowFontScaling={false}
414
+ onLayout={[Function]}
411
415
  style={
412
416
  [
413
417
  {
@@ -670,7 +674,8 @@ exports[`DatePicker renders variant Calendar 1`] = `
670
674
  {
671
675
  "alignItems": "center",
672
676
  "flexDirection": "row",
673
- "left": -32,
677
+ "justifyContent": "center",
678
+ "left": 0,
674
679
  "position": "absolute",
675
680
  "right": 0,
676
681
  "top": -10.666666666666666,
@@ -679,7 +684,7 @@ exports[`DatePicker renders variant Calendar 1`] = `
679
684
  "translateY": 0,
680
685
  },
681
686
  {
682
- "translateX": 48,
687
+ "translateX": 24,
683
688
  },
684
689
  {
685
690
  "scale": 1,
@@ -692,6 +697,7 @@ exports[`DatePicker renders variant Calendar 1`] = `
692
697
  >
693
698
  <Text
694
699
  allowFontScaling={false}
700
+ onLayout={[Function]}
695
701
  style={
696
702
  [
697
703
  {
@@ -108,7 +108,8 @@ exports[`DatePickerAndroid renders correctly 1`] = `
108
108
  {
109
109
  "alignItems": "center",
110
110
  "flexDirection": "row",
111
- "left": -32,
111
+ "justifyContent": "center",
112
+ "left": 0,
112
113
  "position": "absolute",
113
114
  "right": 0,
114
115
  "top": -10.666666666666666,
@@ -117,7 +118,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
117
118
  "translateY": 0,
118
119
  },
119
120
  {
120
- "translateX": 48,
121
+ "translateX": 24,
121
122
  },
122
123
  {
123
124
  "scale": 1,
@@ -130,6 +131,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
130
131
  >
131
132
  <Text
132
133
  allowFontScaling={false}
134
+ onLayout={[Function]}
133
135
  style={
134
136
  [
135
137
  {
@@ -108,7 +108,8 @@ exports[`DatePickerCalendar renders correctly 1`] = `
108
108
  {
109
109
  "alignItems": "center",
110
110
  "flexDirection": "row",
111
- "left": -32,
111
+ "justifyContent": "center",
112
+ "left": 0,
112
113
  "position": "absolute",
113
114
  "right": 0,
114
115
  "top": -10.666666666666666,
@@ -117,7 +118,7 @@ exports[`DatePickerCalendar renders correctly 1`] = `
117
118
  "translateY": 0,
118
119
  },
119
120
  {
120
- "translateX": 48,
121
+ "translateX": 24,
121
122
  },
122
123
  {
123
124
  "scale": 1,
@@ -130,6 +131,7 @@ exports[`DatePickerCalendar renders correctly 1`] = `
130
131
  >
131
132
  <Text
132
133
  allowFontScaling={false}
134
+ onLayout={[Function]}
133
135
  style={
134
136
  [
135
137
  {
@@ -108,7 +108,8 @@ exports[`DatePickerIOS renders correctly 1`] = `
108
108
  {
109
109
  "alignItems": "center",
110
110
  "flexDirection": "row",
111
- "left": -32,
111
+ "justifyContent": "center",
112
+ "left": 0,
112
113
  "position": "absolute",
113
114
  "right": 0,
114
115
  "top": -10.666666666666666,
@@ -117,7 +118,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
117
118
  "translateY": 0,
118
119
  },
119
120
  {
120
- "translateX": 48,
121
+ "translateX": 24,
121
122
  },
122
123
  {
123
124
  "scale": 1,
@@ -130,6 +131,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
130
131
  >
131
132
  <Text
132
133
  allowFontScaling={false}
134
+ onLayout={[Function]}
133
135
  style={
134
136
  [
135
137
  {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Animated, StyleProp, ViewStyle } from 'react-native';
2
+ import { Animated, Platform, StyleProp, ViewStyle } from 'react-native';
3
3
 
4
4
  import {
5
5
  StyledPageControlAnimatedView,
@@ -35,7 +35,10 @@ const PageControl = ({
35
35
  const animatedValue = React.useRef(new Animated.Value(currentPage)).current;
36
36
 
37
37
  React.useEffect(() => {
38
- animatedValue.setValue(currentPage);
38
+ Animated.spring(animatedValue, {
39
+ toValue: currentPage,
40
+ useNativeDriver: Platform.OS !== 'web',
41
+ }).start();
39
42
  }, [currentPage]);
40
43
 
41
44
  return (
@@ -148,7 +148,11 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
148
148
  postMessage(webview.current, message);
149
149
  }
150
150
  };
151
- const [inputHeight, setInputHeight] = React.useState<number>(0);
151
+ const [inputSize, setInputSize] = React.useState<{
152
+ height: number;
153
+ width: number;
154
+ }>({ height: 0, width: 0 });
155
+ const [labelWidth, setLabelWidth] = React.useState<number>(0);
152
156
 
153
157
  const focusAnimation = useRef(new Animated.Value(0)).current;
154
158
 
@@ -162,8 +166,13 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
162
166
  }, [focusAnimation, isEmptyValue, isFocused]);
163
167
 
164
168
  const onLayout = useCallback((event: LayoutChangeEvent) => {
165
- const { height } = event.nativeEvent.layout;
166
- setInputHeight(height);
169
+ const { height, width } = event.nativeEvent.layout;
170
+ setInputSize((prev) => ({ ...prev, height, width }));
171
+ }, []);
172
+
173
+ const onLabelLayout = useCallback((event: LayoutChangeEvent) => {
174
+ const { width } = event.nativeEvent.layout;
175
+ setLabelWidth(width);
167
176
  }, []);
168
177
 
169
178
  useEffect(() => {
@@ -335,13 +344,16 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
335
344
  {
336
345
  translateY: focusAnimation.interpolate({
337
346
  inputRange: [0, 1],
338
- outputRange: [inputHeight / 2, 0],
347
+ outputRange: [inputSize.height / 2, 0],
339
348
  }),
340
349
  },
341
350
  {
342
351
  translateX: focusAnimation.interpolate({
343
352
  inputRange: [0, 1],
344
- outputRange: [theme.space.xxxlarge, 0],
353
+ outputRange: [
354
+ -inputSize.width / 2 + labelWidth / 2 + theme.space.large,
355
+ -inputSize.width / 2 + labelWidth / 2 + theme.space.small,
356
+ ],
345
357
  }),
346
358
  },
347
359
  {
@@ -371,6 +383,7 @@ const RichTextEditor: ComponentType<RichTextEditorProps> = ({
371
383
  }}
372
384
  testID="input-label"
373
385
  themeState={state}
386
+ onLayout={onLabelLayout}
374
387
  >
375
388
  {label}
376
389
  </StyledLabelInsideTextInput>