You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there! Thank you for your work on this project. I noticed one issue that I'm having to patch for my purposes, where the rotationFunction's output is being treated like radians here:
My fix for this is simply to rename deg to rad on L109,L110. Full diff is here:
diff --git a/node_modules/react-native-wheely/lib/WheelPickerItem.js b/node_modules/react-native-wheely/lib/WheelPickerItem.js
index 48e7962..b3d1278 100644
--- a/node_modules/react-native-wheely/lib/WheelPickerItem.js+++ b/node_modules/react-native-wheely/lib/WheelPickerItem.js@@ -78,11 +78,11 @@ const WheelPickerItem = ({ textStyle, style, height, option, index, visibleRest,
return range;
})(),
outputRange: (() => {
- const range = ['0deg'];+ const range = ['0rad'];
for (let x = 1; x <= visibleRest + 1; x++) {
const y = rotationFunction(x);
- range.unshift(`${y}deg`);- range.push(`${y}deg`);+ range.unshift(`${y}rad`);+ range.push(`${y}rad`);
}
return range;
})(),
Now I am able to specify rotationFunction={(x) => x*(Math.PI/6)} with visibleRest = 2 meaning that each step is 30 degrees, and the last visible item is rotated 90 degrees, giving my wheel the impression of a true wheel.
If you'd like, I can put up a PR for this fix, as well as adjusting the default of the rotation function to be... (x) => x*(Math.PI/(2*visibleRest)).
Let me know if you have any further questions, or need any more information from me.
The text was updated successfully, but these errors were encountered:
Jeffdude
changed the title
[Bug] Degress/Radians are being mixed up
[Bug] Degrees/Radians are being mixed up
Jun 6, 2024
Hi there! Thank you for your work on this project. I noticed one issue that I'm having to patch for my purposes, where the
rotationFunction
's output is being treated like radians here:react-native-wheely/src/WheelPickerItem.tsx
Lines 44 to 48 in 4a13bfb
While simultaneously being treated like degress here:
react-native-wheely/src/WheelPickerItem.tsx
Lines 108 to 111 in 4a13bfb
My fix for this is simply to rename
deg
torad
on L109,L110. Full diff is here:Now I am able to specify
rotationFunction={(x) => x*(Math.PI/6)}
withvisibleRest = 2
meaning that each step is 30 degrees, and the last visible item is rotated 90 degrees, giving my wheel the impression of a true wheel.If you'd like, I can put up a PR for this fix, as well as adjusting the default of the rotation function to be...
(x) => x*(Math.PI/(2*visibleRest))
.Let me know if you have any further questions, or need any more information from me.
The text was updated successfully, but these errors were encountered: