From db622d5a576621c32eda546a992cff6781937977 Mon Sep 17 00:00:00 2001 From: Alireza Ghamkhar Date: Thu, 16 Jul 2020 12:56:17 +0430 Subject: [PATCH] fix: fix showing unwanted rotations in header back button (#2051) --- src/components/Appbar/AppbarBackAction.tsx | 56 ++-------------------- src/components/Appbar/AppbarBackIcon.tsx | 43 +++++++++++++++++ 2 files changed, 46 insertions(+), 53 deletions(-) create mode 100644 src/components/Appbar/AppbarBackIcon.tsx diff --git a/src/components/Appbar/AppbarBackAction.tsx b/src/components/Appbar/AppbarBackAction.tsx index 860a9c4e2e..9e595000e2 100644 --- a/src/components/Appbar/AppbarBackAction.tsx +++ b/src/components/Appbar/AppbarBackAction.tsx @@ -1,16 +1,8 @@ import * as React from 'react'; -import { - View, - Image, - I18nManager, - StyleSheet, - Platform, - StyleProp, - ViewStyle, -} from 'react-native'; import { $Omit } from './../../types'; import AppbarAction from './AppbarAction'; -import MaterialCommunityIcon from '../MaterialCommunityIcon'; +import AppbarBackIcon from './AppbarBackIcon'; +import { StyleProp, ViewStyle } from 'react-native'; type Props = $Omit< React.ComponentPropsWithoutRef, @@ -79,50 +71,8 @@ class AppbarBackAction extends React.Component { }; render() { - return ( - - Platform.OS === 'ios' ? ( - - - - ) : ( - - ) - } - /> - ); + return ; } } -const styles = StyleSheet.create({ - wrapper: { - alignItems: 'center', - justifyContent: 'center', - }, - icon: { - height: 21, - width: 21, - resizeMode: 'contain', - }, -}); - export default AppbarBackAction; diff --git a/src/components/Appbar/AppbarBackIcon.tsx b/src/components/Appbar/AppbarBackIcon.tsx new file mode 100644 index 0000000000..133144db82 --- /dev/null +++ b/src/components/Appbar/AppbarBackIcon.tsx @@ -0,0 +1,43 @@ +import * as React from 'react'; +import { Platform, I18nManager, View, Image, StyleSheet } from 'react-native'; +import MaterialCommunityIcon from '../MaterialCommunityIcon'; + +const AppbarBackIcon = ({ size, color }: { size: number; color: string }) => + Platform.OS === 'ios' ? ( + + + + ) : ( + + ); + +const styles = StyleSheet.create({ + wrapper: { + alignItems: 'center', + justifyContent: 'center', + }, + icon: { + height: 21, + width: 21, + resizeMode: 'contain', + }, +}); + +export default AppbarBackIcon;