@eohjsc/react-native-smart-city 0.7.9 → 0.7.10
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.
package/package.json
CHANGED
|
@@ -14,7 +14,11 @@ const SetupScriptEmail = ({ route }) => {
|
|
|
14
14
|
const t = useTranslations();
|
|
15
15
|
const { goBack, navigate } = useNavigation();
|
|
16
16
|
const { automate, unitId, multiUnit } = route.params || {};
|
|
17
|
-
const
|
|
17
|
+
const initialUnitId = useMemo(
|
|
18
|
+
() => unitId || multiUnit.id,
|
|
19
|
+
[unitId, multiUnit?.id]
|
|
20
|
+
);
|
|
21
|
+
const [formData, setFormData] = useState({ unit: initialUnitId });
|
|
18
22
|
|
|
19
23
|
const onChangeTitle = (value) => {
|
|
20
24
|
setFormData((state) => ({
|
|
@@ -32,10 +36,10 @@ const SetupScriptEmail = ({ route }) => {
|
|
|
32
36
|
const onNext = useCallback(async () => {
|
|
33
37
|
navigate(Routes.SetupScriptReceiverEmail, {
|
|
34
38
|
automate,
|
|
35
|
-
unitId:
|
|
39
|
+
unitId: initialUnitId,
|
|
36
40
|
formData,
|
|
37
41
|
});
|
|
38
|
-
}, [
|
|
42
|
+
}, [navigate, automate, initialUnitId, formData]);
|
|
39
43
|
|
|
40
44
|
const canSave = useMemo(() => {
|
|
41
45
|
const { title, message } = formData || {};
|
|
@@ -41,7 +41,7 @@ describe('Test SetupScriptEmail', () => {
|
|
|
41
41
|
useRoute.mockImplementation(() => route);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
it('SetupScriptNotify onPress create script
|
|
44
|
+
it('SetupScriptNotify onPress create script email success', async () => {
|
|
45
45
|
mock.onPost(API.AUTOMATE.ADD_SCRIPT_NOTIFY(1)).reply(200);
|
|
46
46
|
await act(async () => {
|
|
47
47
|
tree = await renderer.create(wrapComponent(route));
|