Skip to content

Commit 09b8aad

Browse files
cortinicofacebook-github-bot
authored andcommitted
Make sure onIntArrayChanged is invoked on RN Tester
Summary: 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 Differential Revision: https://internalfb.com/D50264765 fbshipit-source-id: c58f3a4fe5b6efd2187d88beec992f4fd9eb5451
1 parent a2f1189 commit 09b8aad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 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,7 @@ export default function MyNativeView(props: {}): React.Node {
154155
title="Set Opacity"
155156
onPress={() => {
156157
setOpacity(Math.random());
158+
setArrayValues([Math.random() * 100, Math.random() * 100, Math.random() * 100]);
157159
}}
158160
/>
159161
<Button

0 commit comments

Comments
 (0)