Skip to content

Commit c014ca3

Browse files
committed
fix(demo): handle smart quotes in JSON input
1 parent bc9c2d2 commit c014ca3

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

examples/demo/src/components/modals/TrackEventModal.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import React, { useState } from 'react';
22
import {
3+
KeyboardAvoidingView,
34
Modal,
4-
View,
5+
Platform,
6+
StyleSheet,
57
Text,
68
TextInput,
79
TouchableOpacity,
8-
StyleSheet,
9-
KeyboardAvoidingView,
10-
Platform,
10+
View,
1111
} from 'react-native';
1212
import {
1313
AppColors,
14-
AppTextStyles,
15-
AppSpacing,
1614
AppDialogStyles,
1715
AppInputProps,
16+
AppSpacing,
17+
AppTextStyles,
1818
} from '../../theme';
1919

2020
interface Props {
@@ -47,7 +47,10 @@ export default function TrackEventModal({
4747
}
4848
};
4949

50-
const handlePropertiesChange = (text: string) => {
50+
const handlePropertiesChange = (raw: string) => {
51+
const text = raw
52+
.replace(/[\u201C\u201D]/g, '"')
53+
.replace(/[\u2018\u2019]/g, "'");
5154
setPropertiesText(text);
5255
if (text.trim()) {
5356
validateJson(text);

0 commit comments

Comments
 (0)