Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsocj-cb committed Sep 23, 2022
1 parent 963ea83 commit fbd4036
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
IDEWorkspaceChecks.plist

#Detox
#
Expand Down
4 changes: 2 additions & 2 deletions example/SegmentedControl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {isFabricEnabled} from '../src/utils';

import SegmentedControl from '@react-native-segmented-control/segmented-control';
import JSSegmentedControl from '@react-native-segmented-control/segmented-control/js/SegmentedControl.js';

const isFabricEnabled = global.nativeFabricUIManager !== null;

// Forcing the JS implementation for Fabric as the native module is not compatible with Fabric yet.
export default isFabricEnabled ? JSSegmentedControl : SegmentedControl;
1 change: 1 addition & 0 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ PODS:
- React-logger (= 0.70.0)
- React-perflogger (= 0.70.0)
- React-runtimeexecutor (= 0.70.0)
- RCT-Folly/Fabric (= 2021.07.22.00)
- React-jsi (0.70.0):
- boost (= 1.76.0)
- DoubleConversion
Expand Down

This file was deleted.

12 changes: 7 additions & 5 deletions ios/fabric/RNDateTimePickerComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,20 @@ -(void)updateTextColorForPicker:(UIDatePicker *)picker color:(UIColor *)color
return;
}
}

if (color == nil) {

if (color) {
[picker setValue:color forKey:@"textColor"];
[picker setValue:@(NO) forKey:@"highlightsToday"];
} else {
// Default Text color
if (@available(iOS 13.0, *)) {
color = [UIColor labelColor];
} else {
color = [UIColor blackColor];
}
[picker setValue:color forKey:@"textColor"];
[picker setValue:@(YES) forKey:@"highlightsToday"];
}

[picker setValue:color forKey:@"textColor"];
[picker setValue:@(NO) forKey:@"highlightsToday"];
}

/**
Expand Down
8 changes: 1 addition & 7 deletions src/datetimepicker.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
* @flow strict-local
*/
import RNDateTimePicker from './picker';
import {
dateToMilliseconds,
isFabricEnabled,
sharedPropsValidation,
} from './utils';
import {dateToMilliseconds, sharedPropsValidation} from './utils';
import {IOS_DISPLAY, ANDROID_MODE, EVENT_TYPE_SET} from './constants';
import invariant from 'invariant';
import * as React from 'react';
Expand Down Expand Up @@ -62,7 +58,6 @@ export default function Picker({
}: IOSNativeProps): React.Node {
sharedPropsValidation({value});

const _picker = React.useRef(null);
const display = getDisplaySafe(providedDisplay);

const _onChange = (event: NativeEventIOS) => {
Expand All @@ -81,7 +76,6 @@ export default function Picker({
// $FlowFixMe - dozen of flow errors
<RNDateTimePicker
testID={testID}
ref={_picker}
style={style}
date={dateToMilliseconds(value)}
locale={locale !== null && locale !== '' ? locale : undefined}
Expand Down
2 changes: 0 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,3 @@ export function sharedPropsValidation({value}: {value: ?Date}) {
'`value` prop must be an instance of Date object',
);
}

export const isFabricEnabled = global.nativeFabricUIManager !== null;

0 comments on commit fbd4036

Please sign in to comment.