Skip to content

Commit dbef1d9

Browse files
cortinicohuntie
authored andcommitted
Make sure onIntArrayChanged is invoked on RN Tester (#40940)
Summary: Pull Request resolved: #40940 Currently the `onIntArrayChanged` event is invoked only once inside RN Tester. I'm changing the logic to make sure it fires whenever we click "Set Opacity" Changelog: [Internal] [Changed] - Make sure onIntArrayChanged is invoked on RN Tester Reviewed By: mdvacca, dmytrorykun Differential Revision: D50264765 fbshipit-source-id: 93a60fd1b657c3d8b8182cab6bb7cd4368ac9a42
1 parent 3405272 commit dbef1d9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/rn-tester/NativeComponentExample/js/MyNativeView.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default function MyNativeView(props: {}): React.Node {
8787
const ref = useRef<React.ElementRef<MyNativeViewType> | null>(null);
8888
const legacyRef = useRef<React.ElementRef<MyLegacyViewType> | null>(null);
8989
const [opacity, setOpacity] = useState(1.0);
90+
const [arrayValues, setArrayValues] = useState([1, 2, 3]);
9091
const [hsba, setHsba] = useState<HSBA>(new HSBA());
9192
const [cornerRadiusIndex, setCornerRadiusIndex] = useState<number>(0);
9293
const [legacyMeasure, setLegacyMeasure] =
@@ -102,7 +103,7 @@ export default function MyNativeView(props: {}): React.Node {
102103
ref={ref}
103104
style={{flex: 1}}
104105
opacity={opacity}
105-
values={[0, 1, 2, 3, 4]}
106+
values={arrayValues}
106107
onIntArrayChanged={event => {
107108
console.log(event.nativeEvent.values);
108109
console.log(event.nativeEvent.boolValues);
@@ -154,6 +155,11 @@ export default function MyNativeView(props: {}): React.Node {
154155
title="Set Opacity"
155156
onPress={() => {
156157
setOpacity(Math.random());
158+
setArrayValues([
159+
Math.floor(Math.random() * 100),
160+
Math.floor(Math.random() * 100),
161+
Math.floor(Math.random() * 100),
162+
]);
157163
}}
158164
/>
159165
<Button

0 commit comments

Comments
 (0)