@hero-design/rn 8.45.0 → 8.45.1

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.
@@ -3,6 +3,6 @@ $ rollup -c
3
3
  
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
- (!) 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
6
+ (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/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 22.1s
8
8
  $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.45.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ - [#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
10
+
11
+ - Updated dependencies [[`8c7780262`](https://github.com/Thinkei/hero-design/commit/8c77802626e1069a50b8cf54c0ff36722f5a248f)]:
12
+ - @hero-design/react-native-month-year-picker@8.42.6
13
+
3
14
  ## 8.45.0
4
15
 
5
16
  ### Minor Changes
package/es/index.js CHANGED
@@ -12676,9 +12676,10 @@ var StyledLabelContainerInsideTextInput = index$a(Animated.View)(function (_ref2
12676
12676
  return {
12677
12677
  flexDirection: 'row',
12678
12678
  alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
12679
+ justifyContent: 'center',
12679
12680
  position: 'absolute',
12680
12681
  zIndex: 1,
12681
- left: -theme.__hd__.textInput.space.labelLeft,
12682
+ left: 0,
12682
12683
  right: 0,
12683
12684
  top: -theme.__hd__.textInput.space.labelTop
12684
12685
  };
@@ -12848,18 +12849,25 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
12848
12849
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
12849
12850
  var isEmptyValue = displayText.length === 0;
12850
12851
  var actualSuffix = loading ? 'loading' : suffix;
12851
- var _React$useState = React.useState(0),
12852
+ var _React$useState = React.useState({
12853
+ height: 0,
12854
+ width: 0
12855
+ }),
12852
12856
  _React$useState2 = _slicedToArray(_React$useState, 2),
12853
- inputHeight = _React$useState2[0],
12854
- setInputHeight = _React$useState2[1];
12857
+ inputSize = _React$useState2[0],
12858
+ setInputSize = _React$useState2[1];
12855
12859
  var _React$useState3 = React.useState(0),
12856
12860
  _React$useState4 = _slicedToArray(_React$useState3, 2),
12857
- prefixWidth = _React$useState4[0],
12858
- setPrefixWidth = _React$useState4[1];
12859
- var _React$useState5 = React.useState(false),
12861
+ labelWidth = _React$useState4[0],
12862
+ setLabelWidth = _React$useState4[1];
12863
+ var _React$useState5 = React.useState(0),
12860
12864
  _React$useState6 = _slicedToArray(_React$useState5, 2),
12861
- isFocused = _React$useState6[0],
12862
- setIsFocused = _React$useState6[1];
12865
+ prefixWidth = _React$useState6[0],
12866
+ setPrefixWidth = _React$useState6[1];
12867
+ var _React$useState7 = React.useState(false),
12868
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
12869
+ isFocused = _React$useState8[0],
12870
+ setIsFocused = _React$useState8[1];
12863
12871
  var state = getState$1({
12864
12872
  disabled: disabled,
12865
12873
  error: error,
@@ -12880,13 +12888,24 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
12880
12888
  }).start();
12881
12889
  }, [focusAnimation, isEmptyValue, isFocused]);
12882
12890
  var onLayout = useCallback(function (event) {
12883
- var height = event.nativeEvent.layout.height;
12884
- setInputHeight(height);
12891
+ var _event$nativeEvent$la = event.nativeEvent.layout,
12892
+ height = _event$nativeEvent$la.height,
12893
+ width = _event$nativeEvent$la.width;
12894
+ setInputSize(function (prev) {
12895
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
12896
+ height: height,
12897
+ width: width
12898
+ });
12899
+ });
12885
12900
  }, []);
12886
12901
  var onPrefixLayout = useCallback(function (event) {
12887
12902
  var width = event.nativeEvent.layout.width;
12888
12903
  setPrefixWidth(width);
12889
12904
  }, []);
12905
+ var onLabelLayout = useCallback(function (event) {
12906
+ var width = event.nativeEvent.layout.width;
12907
+ setLabelWidth(width);
12908
+ }, []);
12890
12909
  var innerTextInput = React.useRef();
12891
12910
  React.useImperativeHandle(ref, function () {
12892
12911
  return {
@@ -13009,12 +13028,12 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
13009
13028
  transform: [{
13010
13029
  translateY: focusAnimation.interpolate({
13011
13030
  inputRange: [0, 1],
13012
- outputRange: [variant !== 'textarea' ? inputHeight / 2 : theme.space.large, 0]
13031
+ outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, 0]
13013
13032
  })
13014
13033
  }, {
13015
13034
  translateX: focusAnimation.interpolate({
13016
13035
  inputRange: [0, 1],
13017
- outputRange: [prefix ? prefixWidth * 4 : theme.space.xxxlarge, 0]
13036
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + prefixWidth + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
13018
13037
  })
13019
13038
  }, {
13020
13039
  scale: focusAnimation.interpolate({
@@ -13035,7 +13054,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
13035
13054
  },
13036
13055
  nativeID: accessibilityLabelledBy,
13037
13056
  testID: "input-label",
13038
- themeState: state
13057
+ themeState: state,
13058
+ onLayout: onLabelLayout
13039
13059
  }, label)), /*#__PURE__*/React.createElement(StyledTextInputAndLabelContainer, null, renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React.createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
13040
13060
  themeVariant: variant,
13041
13061
  multiline: variant === 'textarea' || nativeProps.multiline,
@@ -34031,10 +34051,17 @@ var RichTextEditor = function RichTextEditor(_ref) {
34031
34051
  postMessage(webview.current, message);
34032
34052
  }
34033
34053
  };
34034
- var _React$useState = React.useState(0),
34054
+ var _React$useState = React.useState({
34055
+ height: 0,
34056
+ width: 0
34057
+ }),
34035
34058
  _React$useState2 = _slicedToArray(_React$useState, 2),
34036
- inputHeight = _React$useState2[0],
34037
- setInputHeight = _React$useState2[1];
34059
+ inputSize = _React$useState2[0],
34060
+ setInputSize = _React$useState2[1];
34061
+ var _React$useState3 = React.useState(0),
34062
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
34063
+ labelWidth = _React$useState4[0],
34064
+ setLabelWidth = _React$useState4[1];
34038
34065
  var focusAnimation = useRef(new Animated.Value(0)).current;
34039
34066
  useEffect(function () {
34040
34067
  Animated.timing(focusAnimation, {
@@ -34045,8 +34072,19 @@ var RichTextEditor = function RichTextEditor(_ref) {
34045
34072
  }).start();
34046
34073
  }, [focusAnimation, isEmptyValue, isFocused]);
34047
34074
  var onLayout = useCallback(function (event) {
34048
- var height = event.nativeEvent.layout.height;
34049
- setInputHeight(height);
34075
+ var _event$nativeEvent$la = event.nativeEvent.layout,
34076
+ height = _event$nativeEvent$la.height,
34077
+ width = _event$nativeEvent$la.width;
34078
+ setInputSize(function (prev) {
34079
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
34080
+ height: height,
34081
+ width: width
34082
+ });
34083
+ });
34084
+ }, []);
34085
+ var onLabelLayout = useCallback(function (event) {
34086
+ var width = event.nativeEvent.layout.width;
34087
+ setLabelWidth(width);
34050
34088
  }, []);
34051
34089
  useEffect(function () {
34052
34090
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
@@ -34147,12 +34185,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
34147
34185
  transform: [{
34148
34186
  translateY: focusAnimation.interpolate({
34149
34187
  inputRange: [0, 1],
34150
- outputRange: [inputHeight / 2, 0]
34188
+ outputRange: [inputSize.height / 2, 0]
34151
34189
  })
34152
34190
  }, {
34153
34191
  translateX: focusAnimation.interpolate({
34154
34192
  inputRange: [0, 1],
34155
- outputRange: [theme.space.xxxlarge, 0]
34193
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
34156
34194
  })
34157
34195
  }, {
34158
34196
  scale: focusAnimation.interpolate({
@@ -34171,7 +34209,8 @@ var RichTextEditor = function RichTextEditor(_ref) {
34171
34209
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
34172
34210
  },
34173
34211
  testID: "input-label",
34174
- themeState: state
34212
+ themeState: state,
34213
+ onLayout: onLabelLayout
34175
34214
  }, label)), /*#__PURE__*/React.createElement(StyledTextInputContainer, {
34176
34215
  onLayout: onLayout
34177
34216
  }, /*#__PURE__*/React.createElement(StyledBorderBackDrop, {
package/lib/index.js CHANGED
@@ -12706,9 +12706,10 @@ var StyledLabelContainerInsideTextInput = index$a(reactNative.Animated.View)(fun
12706
12706
  return {
12707
12707
  flexDirection: 'row',
12708
12708
  alignItems: themeVariant === 'text' ? 'center' : 'flex-start',
12709
+ justifyContent: 'center',
12709
12710
  position: 'absolute',
12710
12711
  zIndex: 1,
12711
- left: -theme.__hd__.textInput.space.labelLeft,
12712
+ left: 0,
12712
12713
  right: 0,
12713
12714
  top: -theme.__hd__.textInput.space.labelTop
12714
12715
  };
@@ -12878,18 +12879,25 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
12878
12879
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
12879
12880
  var isEmptyValue = displayText.length === 0;
12880
12881
  var actualSuffix = loading ? 'loading' : suffix;
12881
- var _React$useState = React__default["default"].useState(0),
12882
+ var _React$useState = React__default["default"].useState({
12883
+ height: 0,
12884
+ width: 0
12885
+ }),
12882
12886
  _React$useState2 = _slicedToArray(_React$useState, 2),
12883
- inputHeight = _React$useState2[0],
12884
- setInputHeight = _React$useState2[1];
12887
+ inputSize = _React$useState2[0],
12888
+ setInputSize = _React$useState2[1];
12885
12889
  var _React$useState3 = React__default["default"].useState(0),
12886
12890
  _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),
12891
+ labelWidth = _React$useState4[0],
12892
+ setLabelWidth = _React$useState4[1];
12893
+ var _React$useState5 = React__default["default"].useState(0),
12890
12894
  _React$useState6 = _slicedToArray(_React$useState5, 2),
12891
- isFocused = _React$useState6[0],
12892
- setIsFocused = _React$useState6[1];
12895
+ prefixWidth = _React$useState6[0],
12896
+ setPrefixWidth = _React$useState6[1];
12897
+ var _React$useState7 = React__default["default"].useState(false),
12898
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
12899
+ isFocused = _React$useState8[0],
12900
+ setIsFocused = _React$useState8[1];
12893
12901
  var state = getState$1({
12894
12902
  disabled: disabled,
12895
12903
  error: error,
@@ -12910,13 +12918,24 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
12910
12918
  }).start();
12911
12919
  }, [focusAnimation, isEmptyValue, isFocused]);
12912
12920
  var onLayout = React.useCallback(function (event) {
12913
- var height = event.nativeEvent.layout.height;
12914
- setInputHeight(height);
12921
+ var _event$nativeEvent$la = event.nativeEvent.layout,
12922
+ height = _event$nativeEvent$la.height,
12923
+ width = _event$nativeEvent$la.width;
12924
+ setInputSize(function (prev) {
12925
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
12926
+ height: height,
12927
+ width: width
12928
+ });
12929
+ });
12915
12930
  }, []);
12916
12931
  var onPrefixLayout = React.useCallback(function (event) {
12917
12932
  var width = event.nativeEvent.layout.width;
12918
12933
  setPrefixWidth(width);
12919
12934
  }, []);
12935
+ var onLabelLayout = React.useCallback(function (event) {
12936
+ var width = event.nativeEvent.layout.width;
12937
+ setLabelWidth(width);
12938
+ }, []);
12920
12939
  var innerTextInput = React__default["default"].useRef();
12921
12940
  React__default["default"].useImperativeHandle(ref, function () {
12922
12941
  return {
@@ -13039,12 +13058,12 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13039
13058
  transform: [{
13040
13059
  translateY: focusAnimation.interpolate({
13041
13060
  inputRange: [0, 1],
13042
- outputRange: [variant !== 'textarea' ? inputHeight / 2 : theme.space.large, 0]
13061
+ outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, 0]
13043
13062
  })
13044
13063
  }, {
13045
13064
  translateX: focusAnimation.interpolate({
13046
13065
  inputRange: [0, 1],
13047
- outputRange: [prefix ? prefixWidth * 4 : theme.space.xxxlarge, 0]
13066
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + prefixWidth + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
13048
13067
  })
13049
13068
  }, {
13050
13069
  scale: focusAnimation.interpolate({
@@ -13065,7 +13084,8 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
13065
13084
  },
13066
13085
  nativeID: accessibilityLabelledBy,
13067
13086
  testID: "input-label",
13068
- themeState: state
13087
+ themeState: state,
13088
+ onLayout: onLabelLayout
13069
13089
  }, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputAndLabelContainer, null, renderInputValue ? renderInputValue(nativeInputProps) : /*#__PURE__*/React__default["default"].createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
13070
13090
  themeVariant: variant,
13071
13091
  multiline: variant === 'textarea' || nativeProps.multiline,
@@ -34061,10 +34081,17 @@ var RichTextEditor = function RichTextEditor(_ref) {
34061
34081
  postMessage(webview.current, message);
34062
34082
  }
34063
34083
  };
34064
- var _React$useState = React__default["default"].useState(0),
34084
+ var _React$useState = React__default["default"].useState({
34085
+ height: 0,
34086
+ width: 0
34087
+ }),
34065
34088
  _React$useState2 = _slicedToArray(_React$useState, 2),
34066
- inputHeight = _React$useState2[0],
34067
- setInputHeight = _React$useState2[1];
34089
+ inputSize = _React$useState2[0],
34090
+ setInputSize = _React$useState2[1];
34091
+ var _React$useState3 = React__default["default"].useState(0),
34092
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
34093
+ labelWidth = _React$useState4[0],
34094
+ setLabelWidth = _React$useState4[1];
34068
34095
  var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
34069
34096
  React.useEffect(function () {
34070
34097
  reactNative.Animated.timing(focusAnimation, {
@@ -34075,8 +34102,19 @@ var RichTextEditor = function RichTextEditor(_ref) {
34075
34102
  }).start();
34076
34103
  }, [focusAnimation, isEmptyValue, isFocused]);
34077
34104
  var onLayout = React.useCallback(function (event) {
34078
- var height = event.nativeEvent.layout.height;
34079
- setInputHeight(height);
34105
+ var _event$nativeEvent$la = event.nativeEvent.layout,
34106
+ height = _event$nativeEvent$la.height,
34107
+ width = _event$nativeEvent$la.width;
34108
+ setInputSize(function (prev) {
34109
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
34110
+ height: height,
34111
+ width: width
34112
+ });
34113
+ });
34114
+ }, []);
34115
+ var onLabelLayout = React.useCallback(function (event) {
34116
+ var width = event.nativeEvent.layout.width;
34117
+ setLabelWidth(width);
34080
34118
  }, []);
34081
34119
  React.useEffect(function () {
34082
34120
  var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
@@ -34177,12 +34215,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
34177
34215
  transform: [{
34178
34216
  translateY: focusAnimation.interpolate({
34179
34217
  inputRange: [0, 1],
34180
- outputRange: [inputHeight / 2, 0]
34218
+ outputRange: [inputSize.height / 2, 0]
34181
34219
  })
34182
34220
  }, {
34183
34221
  translateX: focusAnimation.interpolate({
34184
34222
  inputRange: [0, 1],
34185
- outputRange: [theme.space.xxxlarge, 0]
34223
+ outputRange: [-inputSize.width / 2 + labelWidth / 2 + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
34186
34224
  })
34187
34225
  }, {
34188
34226
  scale: focusAnimation.interpolate({
@@ -34201,7 +34239,8 @@ var RichTextEditor = function RichTextEditor(_ref) {
34201
34239
  backgroundColor: theme.__hd__.textInput.colors.labelBackground
34202
34240
  },
34203
34241
  testID: "input-label",
34204
- themeState: state
34242
+ themeState: state,
34243
+ onLayout: onLabelLayout
34205
34244
  }, label)), /*#__PURE__*/React__default["default"].createElement(StyledTextInputContainer, {
34206
34245
  onLayout: onLayout
34207
34246
  }, /*#__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.1",
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
  {
@@ -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>
@@ -26,7 +26,8 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
26
26
  {
27
27
  "alignItems": "center",
28
28
  "flexDirection": "row",
29
- "left": -32,
29
+ "justifyContent": "center",
30
+ "left": 0,
30
31
  "position": "absolute",
31
32
  "right": 0,
32
33
  "top": -10.666666666666666,
@@ -35,7 +36,7 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
35
36
  "translateY": 0,
36
37
  },
37
38
  {
38
- "translateX": 48,
39
+ "translateX": 24,
39
40
  },
40
41
  {
41
42
  "scale": 1,
@@ -49,6 +50,7 @@ exports[`RichTextEditor onMessage recevied event editor-layout should update hei
49
50
  >
50
51
  <Text
51
52
  allowFontScaling={false}
53
+ onLayout={[Function]}
52
54
  style={
53
55
  [
54
56
  {
@@ -342,7 +344,8 @@ exports[`RichTextEditor should render correctly 1`] = `
342
344
  {
343
345
  "alignItems": "center",
344
346
  "flexDirection": "row",
345
- "left": -32,
347
+ "justifyContent": "center",
348
+ "left": 0,
346
349
  "position": "absolute",
347
350
  "right": 0,
348
351
  "top": -10.666666666666666,
@@ -351,7 +354,7 @@ exports[`RichTextEditor should render correctly 1`] = `
351
354
  "translateY": 0,
352
355
  },
353
356
  {
354
- "translateX": 48,
357
+ "translateX": 24,
355
358
  },
356
359
  {
357
360
  "scale": 1,
@@ -365,6 +368,7 @@ exports[`RichTextEditor should render correctly 1`] = `
365
368
  >
366
369
  <Text
367
370
  allowFontScaling={false}
371
+ onLayout={[Function]}
368
372
  style={
369
373
  [
370
374
  {