-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iOS): Implement cursor style prop
- Loading branch information
Showing
16 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
typedef NS_ENUM(NSInteger, RCTCursor) { | ||
RCTCursorAuto, | ||
RCTCursorPointer, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const React = require('react'); | ||
const {Image, StyleSheet, View} = require('react-native'); | ||
|
||
const styles = StyleSheet.create({ | ||
box: { | ||
width: 100, | ||
height: 100, | ||
borderWidth: 2, | ||
}, | ||
circle: { | ||
width: 100, | ||
height: 100, | ||
borderWidth: 2, | ||
borderRadius: 50, | ||
}, | ||
halfcircle: { | ||
width: 100, | ||
height: 100, | ||
borderWidth: 2, | ||
borderTopStartRadius: 50, | ||
borderBottomStartRadius: 50, | ||
}, | ||
solid: { | ||
backgroundColor: 'blue', | ||
}, | ||
pointer: { | ||
cursor: 'pointer', | ||
}, | ||
row: { | ||
flexDirection: 'row', | ||
flexWrap: 'wrap', | ||
gap: 10, | ||
} | ||
}); | ||
|
||
function CursorExampleAuto() { | ||
return ( | ||
<View style={styles.row}> | ||
<View style={styles.box} /> | ||
<View style={styles.circle} /> | ||
<View style={styles.halfcircle} /> | ||
<View style={[styles.box, styles.solid]} /> | ||
<View style={[styles.circle, styles.solid]} /> | ||
<View style={[styles.halfcircle, styles.solid]} /> | ||
</View> | ||
); | ||
} | ||
|
||
function CursorExamplePointer() { | ||
return ( | ||
<View style={styles.row}> | ||
<View style={[styles.box, styles.pointer]} /> | ||
<View style={[styles.circle, styles.pointer]} /> | ||
<View style={[styles.halfcircle, styles.pointer]} /> | ||
<View style={[styles.box, styles.solid, styles.pointer]} /> | ||
<View style={[styles.circle, styles.solid, styles.pointer]} /> | ||
<View style={[styles.halfcircle, styles.solid, styles.pointer]} /> | ||
</View> | ||
); | ||
} | ||
|
||
exports.title = 'Cursor'; | ||
exports.category = 'UI'; | ||
exports.description = | ||
'Demonstrates setting a cursor, which affects the appearance when a pointer is over the View.'; | ||
exports.examples = [ | ||
{ | ||
title: 'Default', | ||
description: 'Cursor: \'auto\' or no cursor set ', | ||
render: CursorExampleAuto, | ||
}, | ||
{ | ||
title: 'Pointer', | ||
description: "cursor: pointer", | ||
render: CursorExamplePointer, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters