Skip to content

Commit

Permalink
Merge pull request #32 from THEOplayer/feature/replace_defaultparams
Browse files Browse the repository at this point in the history
Replace defaultProps with JS default params
  • Loading branch information
tvanlaerhoven authored Aug 9, 2024
2 parents c3cf52d + 55b4a7c commit 475fd67
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/ui/components/button/actionbutton/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ActionButtonProps {
/**
* Whether the button should be touchable. This is `true` by default.
*/
touchable: boolean;
touchable?: boolean;
/**
* The callback when the button is pressed.
*/
Expand Down Expand Up @@ -43,12 +43,11 @@ export const DEFAULT_ACTION_BUTTON_STYLE: ViewStyle = {
* The default button component that renders an image/svg source for the `react-native-theoplayer` UI.
*/
export const ActionButton = (props: ActionButtonProps) => {
const { icon, style, touchable, svg, onPress, highlighted } = props;
const { icon, style, svg, onPress, highlighted } = props;
const [focused, setFocused] = useState<boolean>(false);
const context = useContext(PlayerContext);

const shouldChangeTintColor = highlighted || (focused && Platform.isTV);

const touchable = props.touchable != false;
if (!touchable) {
return <View style={[DEFAULT_ACTION_BUTTON_STYLE, style]}>{svg}</View>;
}
Expand Down Expand Up @@ -99,7 +98,3 @@ export const ActionButton = (props: ActionButtonProps) => {
</PlayerContext.Consumer>
);
};

ActionButton.defaultProps = {
touchable: true,
};

0 comments on commit 475fd67

Please sign in to comment.