@archireport/react-native-svg-draw 2.2.0 → 2.2.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.
Files changed (89) hide show
  1. package/lib/commonjs/components/DrawCore/CurrentAnimatedItem.js.map +1 -1
  2. package/lib/commonjs/components/DrawCore/CurrentAnimatedText.js.map +1 -1
  3. package/lib/commonjs/components/DrawCore/DrawContext.js.map +1 -1
  4. package/lib/commonjs/components/DrawCore/DrawPad.js +7 -2
  5. package/lib/commonjs/components/DrawCore/DrawPad.js.map +1 -1
  6. package/lib/commonjs/components/DrawCore/DrawProvider.js.map +1 -1
  7. package/lib/commonjs/components/DrawCore/Item.js.map +1 -1
  8. package/lib/commonjs/components/DrawCore/index.js +28 -23
  9. package/lib/commonjs/components/DrawCore/index.js.map +1 -1
  10. package/lib/commonjs/components/DrawCore/useDrawHook.js.map +1 -1
  11. package/lib/commonjs/components/DrawWithOptions/ArrowSvg.js.map +1 -1
  12. package/lib/commonjs/components/DrawWithOptions/CancelSvg.js.map +1 -1
  13. package/lib/commonjs/components/DrawWithOptions/CircleSvg.js.map +1 -1
  14. package/lib/commonjs/components/DrawWithOptions/CloseSvg.js.map +1 -1
  15. package/lib/commonjs/components/DrawWithOptions/DoubleHeadSvg.js.map +1 -1
  16. package/lib/commonjs/components/DrawWithOptions/PenSvg.js.map +1 -1
  17. package/lib/commonjs/components/DrawWithOptions/SendSvg.js.map +1 -1
  18. package/lib/commonjs/components/DrawWithOptions/SliderSvg.js.map +1 -1
  19. package/lib/commonjs/components/DrawWithOptions/SquareSvg.js.map +1 -1
  20. package/lib/commonjs/components/DrawWithOptions/TextSvg.js.map +1 -1
  21. package/lib/commonjs/components/DrawWithOptions/ThrashSvg.js.map +1 -1
  22. package/lib/commonjs/components/DrawWithOptions/index.js.map +1 -1
  23. package/lib/commonjs/components/Slider/ColorSlider.js.map +1 -1
  24. package/lib/commonjs/components/Slider/Sliders.js.map +1 -1
  25. package/lib/commonjs/components/Slider/StrokeSlider.js.map +1 -1
  26. package/lib/commonjs/components/Slider/sliderStyle.js.map +1 -1
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/module/components/DrawCore/CurrentAnimatedItem.js.map +1 -1
  29. package/lib/module/components/DrawCore/CurrentAnimatedText.js.map +1 -1
  30. package/lib/module/components/DrawCore/DrawContext.js.map +1 -1
  31. package/lib/module/components/DrawCore/DrawPad.js +7 -2
  32. package/lib/module/components/DrawCore/DrawPad.js.map +1 -1
  33. package/lib/module/components/DrawCore/DrawProvider.js.map +1 -1
  34. package/lib/module/components/DrawCore/Item.js.map +1 -1
  35. package/lib/module/components/DrawCore/index.js +28 -23
  36. package/lib/module/components/DrawCore/index.js.map +1 -1
  37. package/lib/module/components/DrawCore/useDrawHook.js.map +1 -1
  38. package/lib/module/components/DrawWithOptions/ArrowSvg.js.map +1 -1
  39. package/lib/module/components/DrawWithOptions/CancelSvg.js.map +1 -1
  40. package/lib/module/components/DrawWithOptions/CircleSvg.js.map +1 -1
  41. package/lib/module/components/DrawWithOptions/CloseSvg.js.map +1 -1
  42. package/lib/module/components/DrawWithOptions/DoubleHeadSvg.js.map +1 -1
  43. package/lib/module/components/DrawWithOptions/PenSvg.js.map +1 -1
  44. package/lib/module/components/DrawWithOptions/SendSvg.js.map +1 -1
  45. package/lib/module/components/DrawWithOptions/SliderSvg.js.map +1 -1
  46. package/lib/module/components/DrawWithOptions/SquareSvg.js.map +1 -1
  47. package/lib/module/components/DrawWithOptions/TextSvg.js.map +1 -1
  48. package/lib/module/components/DrawWithOptions/ThrashSvg.js.map +1 -1
  49. package/lib/module/components/DrawWithOptions/index.js.map +1 -1
  50. package/lib/module/components/Slider/ColorSlider.js.map +1 -1
  51. package/lib/module/components/Slider/Sliders.js.map +1 -1
  52. package/lib/module/components/Slider/StrokeSlider.js.map +1 -1
  53. package/lib/typescript/components/DrawCore/CurrentAnimatedItem.d.ts +1 -0
  54. package/lib/typescript/components/DrawCore/CurrentAnimatedItem.d.ts.map +1 -1
  55. package/lib/typescript/components/DrawCore/CurrentAnimatedText.d.ts +1 -0
  56. package/lib/typescript/components/DrawCore/CurrentAnimatedText.d.ts.map +1 -1
  57. package/lib/typescript/components/DrawCore/DrawPad.d.ts +3 -1
  58. package/lib/typescript/components/DrawCore/DrawPad.d.ts.map +1 -1
  59. package/lib/typescript/components/DrawCore/Item.d.ts +1 -0
  60. package/lib/typescript/components/DrawCore/Item.d.ts.map +1 -1
  61. package/lib/typescript/components/DrawCore/index.d.ts +1 -0
  62. package/lib/typescript/components/DrawCore/index.d.ts.map +1 -1
  63. package/lib/typescript/components/DrawWithOptions/ArrowSvg.d.ts +1 -0
  64. package/lib/typescript/components/DrawWithOptions/ArrowSvg.d.ts.map +1 -1
  65. package/lib/typescript/components/DrawWithOptions/CancelSvg.d.ts +1 -0
  66. package/lib/typescript/components/DrawWithOptions/CancelSvg.d.ts.map +1 -1
  67. package/lib/typescript/components/DrawWithOptions/CircleSvg.d.ts +1 -0
  68. package/lib/typescript/components/DrawWithOptions/CircleSvg.d.ts.map +1 -1
  69. package/lib/typescript/components/DrawWithOptions/CloseSvg.d.ts +1 -0
  70. package/lib/typescript/components/DrawWithOptions/CloseSvg.d.ts.map +1 -1
  71. package/lib/typescript/components/DrawWithOptions/DoubleHeadSvg.d.ts +1 -0
  72. package/lib/typescript/components/DrawWithOptions/DoubleHeadSvg.d.ts.map +1 -1
  73. package/lib/typescript/components/DrawWithOptions/PenSvg.d.ts +1 -0
  74. package/lib/typescript/components/DrawWithOptions/PenSvg.d.ts.map +1 -1
  75. package/lib/typescript/components/DrawWithOptions/SendSvg.d.ts +1 -0
  76. package/lib/typescript/components/DrawWithOptions/SendSvg.d.ts.map +1 -1
  77. package/lib/typescript/components/DrawWithOptions/SliderSvg.d.ts +1 -0
  78. package/lib/typescript/components/DrawWithOptions/SliderSvg.d.ts.map +1 -1
  79. package/lib/typescript/components/DrawWithOptions/SquareSvg.d.ts +1 -0
  80. package/lib/typescript/components/DrawWithOptions/SquareSvg.d.ts.map +1 -1
  81. package/lib/typescript/components/DrawWithOptions/TextSvg.d.ts +1 -0
  82. package/lib/typescript/components/DrawWithOptions/TextSvg.d.ts.map +1 -1
  83. package/lib/typescript/components/DrawWithOptions/ThrashSvg.d.ts +1 -0
  84. package/lib/typescript/components/DrawWithOptions/ThrashSvg.d.ts.map +1 -1
  85. package/lib/typescript/components/Slider/StrokeSlider.d.ts +1 -0
  86. package/lib/typescript/components/Slider/StrokeSlider.d.ts.map +1 -1
  87. package/package.json +1 -1
  88. package/src/components/DrawCore/DrawPad.tsx +3 -1
  89. package/src/components/DrawCore/index.tsx +34 -30
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  declare function SendSvg(props: SvgProps): JSX.Element;
3
4
  export default SendSvg;
@@ -1 +1 @@
1
- {"version":3,"file":"SendSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/SendSvg.tsx"],"names":[],"mappings":"AACA,OAAY,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAC;AAE1D,iBAAS,OAAO,CAAC,KAAK,EAAE,QAAQ,eAQ/B;AAED,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"SendSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/SendSvg.tsx"],"names":[],"mappings":";AACA,OAAY,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAC;AAE1D,iBAAS,OAAO,CAAC,KAAK,EAAE,QAAQ,eAQ/B;AAED,eAAe,OAAO,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  declare function SvgSlider(props: SvgProps): JSX.Element;
3
4
  export default SvgSlider;
@@ -1 +1 @@
1
- {"version":3,"file":"SliderSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/SliderSvg.tsx"],"names":[],"mappings":"AAEA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,iBAAS,SAAS,CAAC,KAAK,EAAE,QAAQ,eAiBjC;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"SliderSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/SliderSvg.tsx"],"names":[],"mappings":";AAEA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,iBAAS,SAAS,CAAC,KAAK,EAAE,QAAQ,eAiBjC;AAED,eAAe,SAAS,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  export default function SquareSvg(props: SvgProps): JSX.Element;
3
4
  //# sourceMappingURL=SquareSvg.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SquareSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/SquareSvg.tsx"],"names":[],"mappings":"AACA,OAAY,EAA4B,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,QAAQ,eAoBhD"}
1
+ {"version":3,"file":"SquareSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/SquareSvg.tsx"],"names":[],"mappings":";AACA,OAAY,EAA4B,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,QAAQ,eAoBhD"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  declare function SvgComponent(props: SvgProps): JSX.Element;
3
4
  export default SvgComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"TextSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/TextSvg.tsx"],"names":[],"mappings":"AACA,OAAY,EAAE,QAAQ,EAA4B,MAAM,kBAAkB,CAAC;AAE3E,iBAAS,YAAY,CAAC,KAAK,EAAE,QAAQ,eAoBpC;AAED,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"TextSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/TextSvg.tsx"],"names":[],"mappings":";AACA,OAAY,EAAE,QAAQ,EAA4B,MAAM,kBAAkB,CAAC;AAE3E,iBAAS,YAAY,CAAC,KAAK,EAAE,QAAQ,eAoBpC;AAED,eAAe,YAAY,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { SvgProps } from 'react-native-svg';
2
3
  declare function ThrashSvg(props: SvgProps): JSX.Element;
3
4
  export default ThrashSvg;
@@ -1 +1 @@
1
- {"version":3,"file":"ThrashSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/ThrashSvg.tsx"],"names":[],"mappings":"AACA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,iBAAS,SAAS,CAAC,KAAK,EAAE,QAAQ,eAiCjC;AAED,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"ThrashSvg.d.ts","sourceRoot":"","sources":["../../../../src/components/DrawWithOptions/ThrashSvg.tsx"],"names":[],"mappings":";AACA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAEvD,iBAAS,SAAS,CAAC,KAAK,EAAE,QAAQ,eAiCjC;AAED,eAAe,SAAS,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const StrokeSlider: ({ minValue, maxValue, }: {
2
3
  minValue: number;
3
4
  maxValue: number;
@@ -1 +1 @@
1
- {"version":3,"file":"StrokeSlider.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/StrokeSlider.tsx"],"names":[],"mappings":"AA6BA,QAAA,MAAM,YAAY;cAIN,MAAM;cACN,MAAM;iBAoEjB,CAAC;AACF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"StrokeSlider.d.ts","sourceRoot":"","sources":["../../../../src/components/Slider/StrokeSlider.tsx"],"names":[],"mappings":";AA6BA,QAAA,MAAM,YAAY;cAIN,MAAM;cACN,MAAM;iBAoEjB,CAAC;AACF,eAAe,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archireport/react-native-svg-draw",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "React Native drawing component based on SVG with editable annotations",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -12,15 +12,17 @@ const DrawPad = ({
12
12
  doneItems,
13
13
  onPressItem,
14
14
  onTextHeightChange,
15
+ addBackground = false,
15
16
  }: {
16
17
  currentItem: Animated.SharedValue<DrawItem | null>;
17
18
  doneItems: Array<DrawItem>;
18
19
  onPressItem: (item: DrawItem, index: number) => () => void;
19
20
  onTextHeightChange: (height: number) => void;
21
+ addBackground?: boolean;
20
22
  }) => {
21
23
  return (
22
24
  <>
23
- <Svg>
25
+ <Svg style={addBackground ? { backgroundColor: 'white' } : null}>
24
26
  <Defs>
25
27
  <Circle
26
28
  id="selectionIndicator"
@@ -35,11 +35,11 @@ const styles = StyleSheet.create({
35
35
  flex: 1,
36
36
  },
37
37
  drawZone: {
38
- flex: 1,
39
38
  alignContent: 'center',
40
39
  alignItems: 'center',
40
+ width: '100%',
41
+ height: '100%',
41
42
  },
42
-
43
43
  bgImage: { width: '100%', height: '100%' },
44
44
  textInput: {
45
45
  backgroundColor: '#262626',
@@ -1151,8 +1151,10 @@ const DrawCore = ({
1151
1151
 
1152
1152
  const textInputContainerStyle = useAnimatedStyle(() => {
1153
1153
  return {
1154
- height: 'auto',
1155
- backgroundColor: 'red',
1154
+ position: 'absolute',
1155
+ top: 0,
1156
+ height: 50,
1157
+ width: '100%',
1156
1158
  display: 'flex',
1157
1159
  opacity: showTextInput.value ? withTiming(1) : withTiming(0),
1158
1160
  };
@@ -1160,7 +1162,8 @@ const DrawCore = ({
1160
1162
 
1161
1163
  const textInputStyle = useAnimatedStyle(() => {
1162
1164
  return {
1163
- backgroundColor: 'blue',
1165
+ color: 'white',
1166
+ height: 20,
1164
1167
  display: showTextInput.value ? 'flex' : 'none',
1165
1168
  opacity: showTextInput.value ? withTiming(1) : withTiming(0),
1166
1169
  };
@@ -1168,31 +1171,6 @@ const DrawCore = ({
1168
1171
 
1169
1172
  return (
1170
1173
  <View style={styles.container}>
1171
- {Platform.OS === 'ios' ? (
1172
- <InputAccessoryView>
1173
- <AnimatedTextInput
1174
- ref={textInputRef}
1175
- style={[styles.textInput, textInputStyle]}
1176
- onEndEditing={textInputRef.current?.clear}
1177
- onChangeText={setTextVal}
1178
- value={textVal}
1179
- autoCorrect={false}
1180
- />
1181
- </InputAccessoryView>
1182
- ) : (
1183
- <Animated.View style={textInputContainerStyle}>
1184
- {currentItem.value?.type === 'text' && (
1185
- <TextInput
1186
- ref={textInputRef}
1187
- style={styles.textInput}
1188
- onEndEditing={textInputRef.current?.clear}
1189
- onChangeText={setTextVal}
1190
- value={textVal}
1191
- autoCorrect={false}
1192
- />
1193
- )}
1194
- </Animated.View>
1195
- )}
1196
1174
  <View
1197
1175
  style={[
1198
1176
  styles.drawZone,
@@ -1239,6 +1217,7 @@ const DrawCore = ({
1239
1217
  style={drawRegion}
1240
1218
  >
1241
1219
  <DrawPad
1220
+ addBackground
1242
1221
  currentItem={currentItem}
1243
1222
  doneItems={drawState.doneItems}
1244
1223
  onPressItem={onPressItem}
@@ -1249,6 +1228,31 @@ const DrawCore = ({
1249
1228
  </View>
1250
1229
  </Animated.View>
1251
1230
  </PanGestureHandler>
1231
+ {Platform.OS === 'ios' ? (
1232
+ <InputAccessoryView>
1233
+ <AnimatedTextInput
1234
+ ref={textInputRef}
1235
+ style={[styles.textInput, textInputStyle]}
1236
+ onEndEditing={textInputRef.current?.clear}
1237
+ onChangeText={setTextVal}
1238
+ value={textVal}
1239
+ autoCorrect={false}
1240
+ />
1241
+ </InputAccessoryView>
1242
+ ) : (
1243
+ <Animated.View style={textInputContainerStyle}>
1244
+ {currentItem.value?.type === 'text' && (
1245
+ <TextInput
1246
+ ref={textInputRef}
1247
+ style={styles.textInput}
1248
+ onEndEditing={textInputRef.current?.clear}
1249
+ onChangeText={setTextVal}
1250
+ value={textVal}
1251
+ autoCorrect={false}
1252
+ />
1253
+ )}
1254
+ </Animated.View>
1255
+ )}
1252
1256
  </View>
1253
1257
  </View>
1254
1258
  );