react-native-showtime 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +58 -0
- package/RNShowTime.podspec +22 -0
- package/ios/RNShowTime.h +5 -0
- package/ios/RNShowTime.mm +83 -0
- package/ios/ShowTimeConfigHelper.swift +72 -0
- package/lib/module/NativeShowTime.js +5 -0
- package/lib/module/NativeShowTime.js.map +1 -0
- package/lib/module/index.js +49 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeShowTime.d.ts +21 -0
- package/lib/typescript/src/NativeShowTime.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +81 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +148 -0
- package/src/NativeShowTime.ts +22 -0
- package/src/index.tsx +142 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Satyajit Sahoo
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# react-native-showtime
|
|
2
|
+
|
|
3
|
+
React Native wrapper for [ShowTime](https://github.com/KaneCheshire/ShowTime) — display touch indicators on iOS. Useful for recordings, demos, and presentations.
|
|
4
|
+
|
|
5
|
+
ShowTime works by visualizing touches as they happen, with zero setup required.
|
|
6
|
+
|
|
7
|
+
<img src="./demo.webp" alt="Demo" width="402" />
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install react-native-showtime
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
ShowTime activates automatically once installed — no code is required to show touch indicators.
|
|
18
|
+
|
|
19
|
+
To customize the touch indicators, call the `configure` with your desired options:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { configure } from 'react-native-showtime';
|
|
23
|
+
|
|
24
|
+
configure({
|
|
25
|
+
enabled: 'always',
|
|
26
|
+
strokeColor: '#3699EC',
|
|
27
|
+
strokeWidth: 3,
|
|
28
|
+
size: 44,
|
|
29
|
+
disappearAnimation: 'standard',
|
|
30
|
+
disappearDelay: 0.2,
|
|
31
|
+
shouldShowMultipleTapCount: true,
|
|
32
|
+
shouldShowForce: true,
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## API
|
|
37
|
+
|
|
38
|
+
### `configure(config)`
|
|
39
|
+
|
|
40
|
+
Configures ShowTime's appearance and behavior. All options are optional.
|
|
41
|
+
|
|
42
|
+
| Option | Type | Default | Description |
|
|
43
|
+
| ------------------------------- | ---------------------------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `enabled` | `'always' \| 'never' \| 'debugOnly'` | `'always'` | Whether ShowTime is enabled. |
|
|
45
|
+
| `fillColor` | `ColorValue \| 'auto'` | `'auto'` | The fill (background) color of a visual touch. When set to `'auto'`, ShowTime automatically uses the stroke color with 50% alpha. |
|
|
46
|
+
| `strokeColor` | `ColorValue` | `'#3699EC'` | The color of the stroke (outline) of a visual touch. |
|
|
47
|
+
| `strokeWidth` | `number` | `3` | The width (thickness) of the stroke around a visual touch. |
|
|
48
|
+
| `size` | `number` | `44` | The size of a visual touch. |
|
|
49
|
+
| `disappearAnimation` | `'standard' \| 'scaleDown' \| 'scaleUp'` | `'standard'` | The style of animation to use when a visual touch disappears. |
|
|
50
|
+
| `disappearDelay` | `number` | `0.2` | The delay, in seconds, before the visual touch disappears after a touch ends. |
|
|
51
|
+
| `shouldShowMultipleTapCount` | `boolean` | `false` | Whether visual touches should indicate a multiple tap (i.e. show a number 2 for a double tap). |
|
|
52
|
+
| `multipleTapCountTextColor` | `ColorValue` | `'#000000'` | The color of the text to use when showing multiple tap counts. |
|
|
53
|
+
| `shouldShowForce` | `boolean` | `true` | Whether visual touches should visually show how much force is applied. |
|
|
54
|
+
| `shouldIgnoreApplePencilEvents` | `boolean` | `true` | Whether touch events from Apple Pencil are ignored. |
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "RNShowTime"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/satya164/react-native-showtime.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
s.dependency "ShowTime", "~> 2.5"
|
|
20
|
+
|
|
21
|
+
install_modules_dependencies(s)
|
|
22
|
+
end
|
package/ios/RNShowTime.h
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#import "RNShowTime.h"
|
|
2
|
+
#if __has_include("RNShowTime/RNShowTime-Swift.h")
|
|
3
|
+
#import "RNShowTime/RNShowTime-Swift.h"
|
|
4
|
+
#else
|
|
5
|
+
#import "RNShowTime-Swift.h"
|
|
6
|
+
#endif
|
|
7
|
+
#import <React/RCTConvert.h>
|
|
8
|
+
|
|
9
|
+
@implementation RNShowTime
|
|
10
|
+
|
|
11
|
+
RCT_EXPORT_MODULE(ShowTime)
|
|
12
|
+
|
|
13
|
+
- (void)configure:(JS::NativeShowTime::NativeShowTimeOptions &)config {
|
|
14
|
+
const auto configCopy = config;
|
|
15
|
+
|
|
16
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
17
|
+
if (configCopy.enabled() != nil) {
|
|
18
|
+
[ShowTimeConfigHelper setEnabled:configCopy.enabled()];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (configCopy.fillColorAuto().has_value() && configCopy.fillColorAuto().value()) {
|
|
22
|
+
[ShowTimeConfigHelper setFillColorAuto];
|
|
23
|
+
} else if (configCopy.fillColor().has_value()) {
|
|
24
|
+
UIColor *color = [RCTConvert UIColor:@(configCopy.fillColor().value())];
|
|
25
|
+
|
|
26
|
+
if (color != nil) {
|
|
27
|
+
[ShowTimeConfigHelper setFillColor:color];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (configCopy.strokeColor().has_value()) {
|
|
32
|
+
UIColor *color = [RCTConvert UIColor:@(configCopy.strokeColor().value())];
|
|
33
|
+
|
|
34
|
+
if (color != nil) {
|
|
35
|
+
[ShowTimeConfigHelper setStrokeColor:color];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (configCopy.strokeWidth().has_value()) {
|
|
40
|
+
[ShowTimeConfigHelper setStrokeWidth:configCopy.strokeWidth().value()];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (configCopy.size().has_value()) {
|
|
44
|
+
[ShowTimeConfigHelper setSize:configCopy.size().value()];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (configCopy.disappearAnimation() != nil) {
|
|
48
|
+
[ShowTimeConfigHelper setDisappearAnimation:configCopy.disappearAnimation()];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (configCopy.disappearDelay().has_value()) {
|
|
52
|
+
[ShowTimeConfigHelper setDisappearDelay:configCopy.disappearDelay().value()];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (configCopy.shouldShowMultipleTapCount().has_value()) {
|
|
56
|
+
[ShowTimeConfigHelper setShouldShowMultipleTapCount:configCopy.shouldShowMultipleTapCount().value()];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (configCopy.multipleTapCountTextColor().has_value()) {
|
|
60
|
+
UIColor *color = [RCTConvert UIColor:@(configCopy.multipleTapCountTextColor().value())];
|
|
61
|
+
|
|
62
|
+
if (color != nil) {
|
|
63
|
+
[ShowTimeConfigHelper setMultipleTapCountTextColor:color];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (configCopy.shouldShowForce().has_value()) {
|
|
68
|
+
[ShowTimeConfigHelper setShouldShowForce:configCopy.shouldShowForce().value()];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (configCopy.shouldIgnoreApplePencilEvents().has_value()) {
|
|
72
|
+
[ShowTimeConfigHelper setShouldIgnoreApplePencilEvents:configCopy.shouldIgnoreApplePencilEvents().value()];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
78
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
79
|
+
{
|
|
80
|
+
return std::make_shared<facebook::react::NativeShowTimeSpecJSI>(params);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import ShowTime
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
@objc(ShowTimeConfigHelper)
|
|
5
|
+
public class ShowTimeConfigHelper: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc public static func setEnabled(_ value: String) {
|
|
8
|
+
switch value {
|
|
9
|
+
case "always":
|
|
10
|
+
ShowTime.enabled = .always
|
|
11
|
+
case "never":
|
|
12
|
+
ShowTime.enabled = .never
|
|
13
|
+
case "debugOnly":
|
|
14
|
+
ShowTime.enabled = .debugOnly
|
|
15
|
+
default:
|
|
16
|
+
break
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@objc public static func setFillColorAuto() {
|
|
21
|
+
ShowTime.fillColor = .auto
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@objc public static func setFillColor(_ color: UIColor) {
|
|
25
|
+
ShowTime.fillColor = color
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@objc public static func setStrokeColor(_ color: UIColor) {
|
|
29
|
+
ShowTime.strokeColor = color
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc public static func setStrokeWidth(_ width: CGFloat) {
|
|
33
|
+
ShowTime.strokeWidth = width
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc public static func setSize(_ size: CGFloat) {
|
|
37
|
+
ShowTime.size = CGSize(width: size, height: size)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@objc public static func setDisappearAnimation(_ name: String) {
|
|
41
|
+
switch name {
|
|
42
|
+
case "standard":
|
|
43
|
+
ShowTime.disappearAnimation = .standard
|
|
44
|
+
case "scaleDown":
|
|
45
|
+
ShowTime.disappearAnimation = .scaleDown
|
|
46
|
+
case "scaleUp":
|
|
47
|
+
ShowTime.disappearAnimation = .scaleUp
|
|
48
|
+
default:
|
|
49
|
+
break
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@objc public static func setDisappearDelay(_ delay: TimeInterval) {
|
|
54
|
+
ShowTime.disappearDelay = delay
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@objc public static func setShouldShowMultipleTapCount(_ show: Bool) {
|
|
58
|
+
ShowTime.shouldShowMultipleTapCount = show
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@objc public static func setMultipleTapCountTextColor(_ color: UIColor) {
|
|
62
|
+
ShowTime.multipleTapCountTextColor = color
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@objc public static func setShouldShowForce(_ show: Bool) {
|
|
66
|
+
ShowTime.shouldShowForce = show
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@objc public static func setShouldIgnoreApplePencilEvents(_ ignore: Bool) {
|
|
70
|
+
ShowTime.shouldIgnoreApplePencilEvents = ignore
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeShowTime.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAqBpE,eAAeA,mBAAmB,CAACC,GAAG,CAAO,UAAU,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform, processColor } from 'react-native';
|
|
4
|
+
import NativeShowTime from "./NativeShowTime.js";
|
|
5
|
+
/**
|
|
6
|
+
* Configure ShowTime touch visualization.
|
|
7
|
+
*/
|
|
8
|
+
export function configure(options) {
|
|
9
|
+
if (Platform.OS !== 'ios') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const {
|
|
13
|
+
fillColor,
|
|
14
|
+
strokeColor,
|
|
15
|
+
multipleTapCountTextColor,
|
|
16
|
+
...rest
|
|
17
|
+
} = options;
|
|
18
|
+
const nativeConfig = {
|
|
19
|
+
...rest
|
|
20
|
+
};
|
|
21
|
+
if (fillColor === 'auto') {
|
|
22
|
+
nativeConfig.fillColorAuto = true;
|
|
23
|
+
} else if (fillColor != null) {
|
|
24
|
+
const processed = processColor(fillColor);
|
|
25
|
+
if (typeof processed === 'number') {
|
|
26
|
+
nativeConfig.fillColor = processed;
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error(`Invalid fillColor: ${String(fillColor)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (strokeColor != null) {
|
|
32
|
+
const processed = processColor(strokeColor);
|
|
33
|
+
if (typeof processed === 'number') {
|
|
34
|
+
nativeConfig.strokeColor = processed;
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error(`Invalid strokeColor: ${String(strokeColor)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (multipleTapCountTextColor != null) {
|
|
40
|
+
const processed = processColor(multipleTapCountTextColor);
|
|
41
|
+
if (typeof processed === 'number') {
|
|
42
|
+
nativeConfig.multipleTapCountTextColor = processed;
|
|
43
|
+
} else {
|
|
44
|
+
throw new Error(`Invalid multipleTapCountTextColor: ${String(multipleTapCountTextColor)}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
NativeShowTime?.configure(nativeConfig);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","processColor","NativeShowTime","configure","options","OS","fillColor","strokeColor","multipleTapCountTextColor","rest","nativeConfig","fillColorAuto","processed","Error","String"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,YAAY,QAAyB,cAAc;AACtE,OAAOC,cAAc,MAAsC,qBAAkB;AA0F7E;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,OAAwB,EAAQ;EACxD,IAAIJ,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;IACzB;EACF;EAEA,MAAM;IAAEC,SAAS;IAAEC,WAAW;IAAEC,yBAAyB;IAAE,GAAGC;EAAK,CAAC,GAClEL,OAAO;EAET,MAAMM,YAAmC,GAAG;IAAE,GAAGD;EAAK,CAAC;EAEvD,IAAIH,SAAS,KAAK,MAAM,EAAE;IACxBI,YAAY,CAACC,aAAa,GAAG,IAAI;EACnC,CAAC,MAAM,IAAIL,SAAS,IAAI,IAAI,EAAE;IAC5B,MAAMM,SAAS,GAAGX,YAAY,CAACK,SAAS,CAAC;IAEzC,IAAI,OAAOM,SAAS,KAAK,QAAQ,EAAE;MACjCF,YAAY,CAACJ,SAAS,GAAGM,SAAS;IACpC,CAAC,MAAM;MACL,MAAM,IAAIC,KAAK,CAAC,sBAAsBC,MAAM,CAACR,SAAS,CAAC,EAAE,CAAC;IAC5D;EACF;EAEA,IAAIC,WAAW,IAAI,IAAI,EAAE;IACvB,MAAMK,SAAS,GAAGX,YAAY,CAACM,WAAW,CAAC;IAE3C,IAAI,OAAOK,SAAS,KAAK,QAAQ,EAAE;MACjCF,YAAY,CAACH,WAAW,GAAGK,SAAS;IACtC,CAAC,MAAM;MACL,MAAM,IAAIC,KAAK,CAAC,wBAAwBC,MAAM,CAACP,WAAW,CAAC,EAAE,CAAC;IAChE;EACF;EAEA,IAAIC,yBAAyB,IAAI,IAAI,EAAE;IACrC,MAAMI,SAAS,GAAGX,YAAY,CAACO,yBAAyB,CAAC;IAEzD,IAAI,OAAOI,SAAS,KAAK,QAAQ,EAAE;MACjCF,YAAY,CAACF,yBAAyB,GAAGI,SAAS;IACpD,CAAC,MAAM;MACL,MAAM,IAAIC,KAAK,CACb,sCAAsCC,MAAM,CAC1CN,yBACF,CAAC,EACH,CAAC;IACH;EACF;EAEAN,cAAc,EAAEC,SAAS,CAACO,YAAY,CAAC;AACzC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
export type NativeShowTimeOptions = {
|
|
3
|
+
enabled?: string | undefined;
|
|
4
|
+
fillColor?: number | undefined;
|
|
5
|
+
fillColorAuto?: boolean | undefined;
|
|
6
|
+
strokeColor?: number | undefined;
|
|
7
|
+
strokeWidth?: number | undefined;
|
|
8
|
+
size?: number | undefined;
|
|
9
|
+
disappearAnimation?: string | undefined;
|
|
10
|
+
disappearDelay?: number | undefined;
|
|
11
|
+
shouldShowMultipleTapCount?: boolean | undefined;
|
|
12
|
+
multipleTapCountTextColor?: number | undefined;
|
|
13
|
+
shouldShowForce?: boolean | undefined;
|
|
14
|
+
shouldIgnoreApplePencilEvents?: boolean | undefined;
|
|
15
|
+
};
|
|
16
|
+
export interface Spec extends TurboModule {
|
|
17
|
+
configure(config: NativeShowTimeOptions): void;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: Spec | null | undefined;
|
|
20
|
+
export default _default;
|
|
21
|
+
//# sourceMappingURL=NativeShowTime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeShowTime.d.ts","sourceRoot":"","sources":["../../../src/NativeShowTime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,0BAA0B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjD,yBAAyB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/C,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,6BAA6B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAChD;;AAED,wBAAyD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type ColorValue } from 'react-native';
|
|
2
|
+
export type EnabledMode = 'always' | 'never' | 'debugOnly';
|
|
3
|
+
export type DisappearAnimation = 'standard' | 'scaleDown' | 'scaleUp';
|
|
4
|
+
export type ShowTimeOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Whether ShowTime is enabled.
|
|
7
|
+
*
|
|
8
|
+
* @default 'always'
|
|
9
|
+
*/
|
|
10
|
+
enabled?: EnabledMode | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The fill (background) color of a visual touch.
|
|
13
|
+
* When set to `'auto'`, ShowTime automatically uses the stroke color
|
|
14
|
+
* with 50% alpha.
|
|
15
|
+
*
|
|
16
|
+
* @default 'auto'
|
|
17
|
+
*/
|
|
18
|
+
fillColor?: ColorValue | 'auto' | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The color of the stroke (outline) of a visual touch.
|
|
21
|
+
*
|
|
22
|
+
* @default '#3699EC'
|
|
23
|
+
*/
|
|
24
|
+
strokeColor?: ColorValue | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The width (thickness) of the stroke around a visual touch.
|
|
27
|
+
*
|
|
28
|
+
* @default 3
|
|
29
|
+
*/
|
|
30
|
+
strokeWidth?: number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The size of a visual touch.
|
|
33
|
+
*
|
|
34
|
+
* @default 44
|
|
35
|
+
*/
|
|
36
|
+
size?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The style of animation to use when a visual touch disappears.
|
|
39
|
+
*
|
|
40
|
+
* @default 'standard'
|
|
41
|
+
*/
|
|
42
|
+
disappearAnimation?: DisappearAnimation | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The delay, in seconds, before the visual touch disappears
|
|
45
|
+
* after a touch ends.
|
|
46
|
+
*
|
|
47
|
+
* @default 0.2
|
|
48
|
+
*/
|
|
49
|
+
disappearDelay?: number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Whether visual touches should indicate a multiple tap
|
|
52
|
+
* (i.e. show a number 2 for a double tap).
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
shouldShowMultipleTapCount?: boolean | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* The color of the text to use when showing multiple tap counts.
|
|
59
|
+
*
|
|
60
|
+
* @default '#000000'
|
|
61
|
+
*/
|
|
62
|
+
multipleTapCountTextColor?: ColorValue | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Whether visual touches should visually show how much force
|
|
65
|
+
* is applied.
|
|
66
|
+
*
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
shouldShowForce?: boolean | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Whether touch events from Apple Pencil are ignored.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
shouldIgnoreApplePencilEvents?: boolean | undefined;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Configure ShowTime touch visualization.
|
|
79
|
+
*/
|
|
80
|
+
export declare function configure(options: ShowTimeOptions): void;
|
|
81
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAGvE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAEtE,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAElC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IAE5C;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAErC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAEpD;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjD;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAEnD;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEtC;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACrD,CAAC;AAEF;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CA+CxD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-showtime",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "ShowTime wrapper for React Native - Display taps and gestures on iOS",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"ios",
|
|
19
|
+
"cpp",
|
|
20
|
+
"*.podspec",
|
|
21
|
+
"react-native.config.js",
|
|
22
|
+
"!ios/build",
|
|
23
|
+
"!**/__tests__",
|
|
24
|
+
"!**/__fixtures__",
|
|
25
|
+
"!**/__mocks__",
|
|
26
|
+
"!**/.*"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"example": "yarn workspace react-native-showtime-example",
|
|
30
|
+
"clean": "del-cli lib",
|
|
31
|
+
"prepare": "bob build",
|
|
32
|
+
"typecheck": "tsc",
|
|
33
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
34
|
+
"release": "release-it --only-version"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"react-native",
|
|
38
|
+
"ios"
|
|
39
|
+
],
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/satya164/react-native-showtime.git"
|
|
43
|
+
},
|
|
44
|
+
"author": "Satyajit Sahoo <satyajit.happy@gmail.com> (https://github.com/satya164)",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/satya164/react-native-showtime/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/satya164/react-native-showtime#readme",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"registry": "https://registry.npmjs.org/"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
55
|
+
"@eslint/compat": "^1.3.2",
|
|
56
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
57
|
+
"@eslint/js": "^9.35.0",
|
|
58
|
+
"@react-native/babel-preset": "0.83.0",
|
|
59
|
+
"@react-native/eslint-config": "0.83.0",
|
|
60
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
61
|
+
"@types/react": "^19.1.12",
|
|
62
|
+
"commitlint": "^19.8.1",
|
|
63
|
+
"del-cli": "^6.0.0",
|
|
64
|
+
"eslint": "^9.35.0",
|
|
65
|
+
"eslint-config-prettier": "^10.1.8",
|
|
66
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
67
|
+
"lefthook": "^2.0.3",
|
|
68
|
+
"prettier": "^2.8.8",
|
|
69
|
+
"react": "19.2.0",
|
|
70
|
+
"react-native": "0.83.2",
|
|
71
|
+
"react-native-builder-bob": "^0.40.18",
|
|
72
|
+
"release-it": "^19.0.4",
|
|
73
|
+
"turbo": "^2.5.6",
|
|
74
|
+
"typescript": "^5.9.2"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"react": "*",
|
|
78
|
+
"react-native": "*"
|
|
79
|
+
},
|
|
80
|
+
"workspaces": [
|
|
81
|
+
"example"
|
|
82
|
+
],
|
|
83
|
+
"packageManager": "yarn@4.11.0",
|
|
84
|
+
"react-native-builder-bob": {
|
|
85
|
+
"source": "src",
|
|
86
|
+
"output": "lib",
|
|
87
|
+
"targets": [
|
|
88
|
+
[
|
|
89
|
+
"module",
|
|
90
|
+
{
|
|
91
|
+
"esm": true
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
"typescript",
|
|
96
|
+
{
|
|
97
|
+
"project": "tsconfig.build.json"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"prettier": {
|
|
103
|
+
"quoteProps": "consistent",
|
|
104
|
+
"singleQuote": true,
|
|
105
|
+
"tabWidth": 2,
|
|
106
|
+
"trailingComma": "es5",
|
|
107
|
+
"useTabs": false
|
|
108
|
+
},
|
|
109
|
+
"commitlint": {
|
|
110
|
+
"extends": [
|
|
111
|
+
"@commitlint/config-conventional"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"release-it": {
|
|
115
|
+
"git": {
|
|
116
|
+
"commitMessage": "chore: release ${version}",
|
|
117
|
+
"tagName": "v${version}"
|
|
118
|
+
},
|
|
119
|
+
"npm": {
|
|
120
|
+
"publish": true
|
|
121
|
+
},
|
|
122
|
+
"github": {
|
|
123
|
+
"release": true
|
|
124
|
+
},
|
|
125
|
+
"plugins": {
|
|
126
|
+
"@release-it/conventional-changelog": {
|
|
127
|
+
"preset": {
|
|
128
|
+
"name": "angular"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"codegenConfig": {
|
|
134
|
+
"name": "ShowTimeSpec",
|
|
135
|
+
"type": "modules",
|
|
136
|
+
"jsSrcsDir": "src"
|
|
137
|
+
},
|
|
138
|
+
"create-react-native-library": {
|
|
139
|
+
"type": "turbo-module",
|
|
140
|
+
"languages": "kotlin-objc",
|
|
141
|
+
"tools": [
|
|
142
|
+
"eslint",
|
|
143
|
+
"lefthook",
|
|
144
|
+
"release-it"
|
|
145
|
+
],
|
|
146
|
+
"version": "0.57.2"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TurboModuleRegistry, type TurboModule } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type NativeShowTimeOptions = {
|
|
4
|
+
enabled?: string | undefined;
|
|
5
|
+
fillColor?: number | undefined;
|
|
6
|
+
fillColorAuto?: boolean | undefined;
|
|
7
|
+
strokeColor?: number | undefined;
|
|
8
|
+
strokeWidth?: number | undefined;
|
|
9
|
+
size?: number | undefined;
|
|
10
|
+
disappearAnimation?: string | undefined;
|
|
11
|
+
disappearDelay?: number | undefined;
|
|
12
|
+
shouldShowMultipleTapCount?: boolean | undefined;
|
|
13
|
+
multipleTapCountTextColor?: number | undefined;
|
|
14
|
+
shouldShowForce?: boolean | undefined;
|
|
15
|
+
shouldIgnoreApplePencilEvents?: boolean | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export interface Spec extends TurboModule {
|
|
19
|
+
configure(config: NativeShowTimeOptions): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default TurboModuleRegistry.get<Spec>('ShowTime');
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Platform, processColor, type ColorValue } from 'react-native';
|
|
2
|
+
import NativeShowTime, { type NativeShowTimeOptions } from './NativeShowTime';
|
|
3
|
+
|
|
4
|
+
export type EnabledMode = 'always' | 'never' | 'debugOnly';
|
|
5
|
+
|
|
6
|
+
export type DisappearAnimation = 'standard' | 'scaleDown' | 'scaleUp';
|
|
7
|
+
|
|
8
|
+
export type ShowTimeOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether ShowTime is enabled.
|
|
11
|
+
*
|
|
12
|
+
* @default 'always'
|
|
13
|
+
*/
|
|
14
|
+
enabled?: EnabledMode | undefined;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The fill (background) color of a visual touch.
|
|
18
|
+
* When set to `'auto'`, ShowTime automatically uses the stroke color
|
|
19
|
+
* with 50% alpha.
|
|
20
|
+
*
|
|
21
|
+
* @default 'auto'
|
|
22
|
+
*/
|
|
23
|
+
fillColor?: ColorValue | 'auto' | undefined;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The color of the stroke (outline) of a visual touch.
|
|
27
|
+
*
|
|
28
|
+
* @default '#3699EC'
|
|
29
|
+
*/
|
|
30
|
+
strokeColor?: ColorValue | undefined;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The width (thickness) of the stroke around a visual touch.
|
|
34
|
+
*
|
|
35
|
+
* @default 3
|
|
36
|
+
*/
|
|
37
|
+
strokeWidth?: number | undefined;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The size of a visual touch.
|
|
41
|
+
*
|
|
42
|
+
* @default 44
|
|
43
|
+
*/
|
|
44
|
+
size?: number | undefined;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The style of animation to use when a visual touch disappears.
|
|
48
|
+
*
|
|
49
|
+
* @default 'standard'
|
|
50
|
+
*/
|
|
51
|
+
disappearAnimation?: DisappearAnimation | undefined;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The delay, in seconds, before the visual touch disappears
|
|
55
|
+
* after a touch ends.
|
|
56
|
+
*
|
|
57
|
+
* @default 0.2
|
|
58
|
+
*/
|
|
59
|
+
disappearDelay?: number | undefined;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Whether visual touches should indicate a multiple tap
|
|
63
|
+
* (i.e. show a number 2 for a double tap).
|
|
64
|
+
*
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
shouldShowMultipleTapCount?: boolean | undefined;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The color of the text to use when showing multiple tap counts.
|
|
71
|
+
*
|
|
72
|
+
* @default '#000000'
|
|
73
|
+
*/
|
|
74
|
+
multipleTapCountTextColor?: ColorValue | undefined;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Whether visual touches should visually show how much force
|
|
78
|
+
* is applied.
|
|
79
|
+
*
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
shouldShowForce?: boolean | undefined;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether touch events from Apple Pencil are ignored.
|
|
86
|
+
*
|
|
87
|
+
* @default true
|
|
88
|
+
*/
|
|
89
|
+
shouldIgnoreApplePencilEvents?: boolean | undefined;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Configure ShowTime touch visualization.
|
|
94
|
+
*/
|
|
95
|
+
export function configure(options: ShowTimeOptions): void {
|
|
96
|
+
if (Platform.OS !== 'ios') {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const { fillColor, strokeColor, multipleTapCountTextColor, ...rest } =
|
|
101
|
+
options;
|
|
102
|
+
|
|
103
|
+
const nativeConfig: NativeShowTimeOptions = { ...rest };
|
|
104
|
+
|
|
105
|
+
if (fillColor === 'auto') {
|
|
106
|
+
nativeConfig.fillColorAuto = true;
|
|
107
|
+
} else if (fillColor != null) {
|
|
108
|
+
const processed = processColor(fillColor);
|
|
109
|
+
|
|
110
|
+
if (typeof processed === 'number') {
|
|
111
|
+
nativeConfig.fillColor = processed;
|
|
112
|
+
} else {
|
|
113
|
+
throw new Error(`Invalid fillColor: ${String(fillColor)}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (strokeColor != null) {
|
|
118
|
+
const processed = processColor(strokeColor);
|
|
119
|
+
|
|
120
|
+
if (typeof processed === 'number') {
|
|
121
|
+
nativeConfig.strokeColor = processed;
|
|
122
|
+
} else {
|
|
123
|
+
throw new Error(`Invalid strokeColor: ${String(strokeColor)}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (multipleTapCountTextColor != null) {
|
|
128
|
+
const processed = processColor(multipleTapCountTextColor);
|
|
129
|
+
|
|
130
|
+
if (typeof processed === 'number') {
|
|
131
|
+
nativeConfig.multipleTapCountTextColor = processed;
|
|
132
|
+
} else {
|
|
133
|
+
throw new Error(
|
|
134
|
+
`Invalid multipleTapCountTextColor: ${String(
|
|
135
|
+
multipleTapCountTextColor
|
|
136
|
+
)}`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
NativeShowTime?.configure(nativeConfig);
|
|
142
|
+
}
|