Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzitelli committed Feb 28, 2022
1 parent fa35cbe commit ec2deff
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 73 deletions.
8 changes: 1 addition & 7 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,4 @@ export const beforeStart = async (): PVoid => {

export const App = () => Root(Screen(screens.get('Main'))); // or Root(Stack(Component(screens.get('Main'))))
export const TabsApp = () =>
Root(
BottomTabs([
Screen(screens.get('Main')),
Screen(screens.get('Example')),
Screen(screens.get('Settings')),
]),
);
Root(BottomTabs([Screen(screens.get('Main')), Screen(screens.get('Example')), Screen(screens.get('Settings'))]));
11 changes: 2 additions & 9 deletions src/components/action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,14 @@ type ActionProps = {
onPress?: () => void;
};

export const Action: React.FC<ActionProps> = ({
title,
icon,
rightIcon,
info,
disabled,
onPress,
}: ActionProps) => {
export const Action: React.FC<ActionProps> = ({title, icon, rightIcon, info, disabled, onPress}: ActionProps) => {
const b = {disabled, onPress};
const iconSize = 22;

return (
<View padding-s4>
<Bounceable {...b}>
<Row style={{justifyContent: 'space-between'}}>
<Row spread>
<Row>
{icon ? (
<View marginR-s2>
Expand Down
4 changes: 1 addition & 3 deletions src/components/component-sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ type ExampleComponentProps = {
title?: string;
};

export const ExampleComponent: React.FC<ExampleComponentProps> = ({
title,
}: ExampleComponentProps) => {
export const ExampleComponent: React.FC<ExampleComponentProps> = ({title}: ExampleComponentProps) => {
return (
<View>
<Text>{title}</Text>
Expand Down
11 changes: 7 additions & 4 deletions src/components/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const Icon: React.FC<IconProps> = ({
onPress,
bounceable = true,
}: IconProps) => {
const Icon = useMemo(
const _Icon = useMemo(
() => (
<View {...viewProps}>
<IconComponent name={name} size={size} color={color} />
Expand All @@ -32,10 +32,13 @@ export const Icon: React.FC<IconProps> = ({
[viewProps, name, size, color],
);

if (!bounceable) return Icon;
if (!bounceable) {
return _Icon;
}

return (
<Bounceable onPress={onPress} disabled={!!!onPress}>
{Icon}
<Bounceable onPress={onPress} disabled={!onPress}>
{_Icon}
</Bounceable>
);
};
10 changes: 2 additions & 8 deletions src/screens/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ export const Main: ScreenComponent = observer(({componentId}) => {
<BButton
marginV-s1
label={t.do('section.navigation.button.passProps')}
onPress={() =>
screens.push<ExampleScreenProps>(componentId, 'Example', {value: randomNum()})
}
onPress={() => screens.push<ExampleScreenProps>(componentId, 'Example', {value: randomNum()})}
/>
<BButton
marginV-s1
Expand Down Expand Up @@ -94,11 +92,7 @@ export const Main: ScreenComponent = observer(({componentId}) => {
</Text>
<Text marginB-s2 text60R textColor>
Counter:{' '}
<If
_={counter.loading}
_then={() => <ActivityIndicator />}
_else={<Text>{counter.value}</Text>}
/>
<If _={counter.loading} _then={() => <ActivityIndicator />} _else={<Text>{counter.value}</Text>} />
</Text>
<BButton margin-s1 label="-" onPress={counter.dec} />
<BButton margin-s1 label="+" onPress={counter.inc} />
Expand Down
10 changes: 2 additions & 8 deletions src/screens/screen-sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export const Example: ScreenComponent<ExampleScreenProps> = observer(({component
<BButton
marginV-s1
label={t.do('section.navigation.button.passProps')}
onPress={() =>
screens.push<ExampleScreenProps>(componentId, 'Example', {value: randomNum()})
}
onPress={() => screens.push<ExampleScreenProps>(componentId, 'Example', {value: randomNum()})}
/>
</View>

Expand All @@ -51,11 +49,7 @@ export const Example: ScreenComponent<ExampleScreenProps> = observer(({component
</Section>

<Reanimated2 stID="reanimated2" />
<BButton
marginV-s1
label={t.do('section.navigation.button.back')}
onPress={() => screens.pop(componentId)}
/>
<BButton marginV-s1 label={t.do('section.navigation.button.back')} onPress={() => screens.pop(componentId)} />

<Text textColor center>
localized with i18n-js
Expand Down
22 changes: 4 additions & 18 deletions src/screens/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ export const Settings: ScreenComponent = observer(() => {
console.log(option);
};

const appearanceActions: AppearanceAction[] = useMemo(
() => [{name: 'System'}, {name: 'Light'}, {name: 'Dark'}],
[],
);
const appearanceActions: AppearanceAction[] = useMemo(() => [{name: 'System'}, {name: 'Light'}, {name: 'Dark'}], []);
const AppearanceActionSheet = useMemo(
() => (
<ActionSheet
Expand All @@ -81,10 +78,7 @@ export const Settings: ScreenComponent = observer(() => {
[pickers.appearance],
);

const languageActions: LanguageAction[] = useMemo(
() => [{name: 'System'}, {name: 'English'}, {name: 'Russian'}],
[],
);
const languageActions: LanguageAction[] = useMemo(() => [{name: 'System'}, {name: 'English'}, {name: 'Russian'}], []);
const LanguageActionSheet = useMemo(
() => (
<ActionSheet
Expand Down Expand Up @@ -157,16 +151,8 @@ export const Settings: ScreenComponent = observer(() => {

<Section bg title="About">
<View>
<Action
disabled
title="App name"
info={Application.applicationName ?? 'No app name'}
/>
<Action
disabled
title="Version"
info={Application.nativeApplicationVersion ?? '0.0'}
/>
<Action disabled title="App name" info={Application.applicationName ?? 'No app name'} />
<Action disabled title="Version" info={Application.nativeApplicationVersion ?? '0.0'} />
</View>
</Section>
</View>
Expand Down
11 changes: 2 additions & 9 deletions src/services/navigation/sharedTransition.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import {
AnimationOptions,
Options,
SharedElementTransition,
StackAnimationOptions,
} from 'react-native-navigation';
import {AnimationOptions, Options, SharedElementTransition, StackAnimationOptions} from 'react-native-navigation';
import {SharedTransitionElement, SharedTransitionId, SharedTransitionNativeId} from './types';

export const genNativeId = (id?: SharedTransitionId): SharedTransitionNativeId => id || 'id';

export const genSharedElementTransition = (
e: SharedTransitionElement,
): SharedElementTransition => ({
export const genSharedElementTransition = (e: SharedTransitionElement): SharedElementTransition => ({
...e.rest,
fromId: genNativeId(e.id),
toId: genNativeId(e.id),
Expand Down
8 changes: 1 addition & 7 deletions src/stores/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@ export class UIStore implements IStore {

makePersistable(this, {
name: UIStore.name,
properties: [
'appLaunches',
'isSystemAppearance',
'appearance',
'isSystemLanguage',
'language',
],
properties: ['appLaunches', 'isSystemAppearance', 'appearance', 'isSystemLanguage', 'language'],
});
}

Expand Down

0 comments on commit ec2deff

Please sign in to comment.