react-native-copilot
react-native-copilot copied to clipboard
Change Arrow Color and backdrop color
Current Behavior The top arrow color cannot be changed backdrop color also don't work
I tried this for backdrop and it didn't work Input Code
export default copilot({
animated: true, // Can be true or false
overlay: 'svg', // Can be either view or svg
backdropColor:"rgb(0, 0, 0, 0.9)",
stepNumberComponent: StepNumber1,
tooltipComponent:TooltipComponent1
})(Homepage);
Expected behavior/code
There should be some way to customise arrow color and backdrop color,
Arrow color is hard-coded here in CopilotModal.js
:
if (verticalPosition === 'bottom') {
tooltip.top = obj.top + obj.height + MARGIN;
arrow.borderBottomColor = '#fff';
arrow.top = tooltip.top - (ARROW_SIZE * 2);
} else {
tooltip.bottom = layout.height - (obj.top - MARGIN);
arrow.borderTopColor = '#fff';
arrow.bottom = tooltip.bottom - (ARROW_SIZE * 2);
}
and backdrop color is here:
<Svg pointerEvents="none" width={this.state.canvasSize.x} height={this.state.canvasSize.y}>
<AnimatedSvgPath
ref={(ref) => { this.mask = ref; }}
fill="rgba(0, 0, 0, 0.4)"
fillRule="evenodd"
strokeWidth={1}
d={path(this.state.size, this.state.position, this.state.canvasSize)}
/>
</Svg>
Environment
- Device: iPhone 6s Simulator
- OS:iOS12
-
react-native-copilot
: v2.4.1 -
react-native
: v0.57 -
react-native-svg
: v7.1.0
@AishwaryaSurana Can you try rgba
instead of rgb
? like backdropColor:"rgba(0, 0, 0, 0.9)"
.
I tried rgba
as well. It didn't work.
Same problem with @AishwaryaSurana in Android
Are you using ViewMask
? Changing the overlay color is currently possible only with SvgMask
.
It would be awesome to be able to change the arrow and tooltip background colours. Currently they are hardcoded. As @AishwaryaSurana mentioned, arrow color is hardcoded in components/CopilotModal,js
, and the tooltip background colour is hardcoded in components/style.js
…
I was able to change the backdrop color after installing with command:
npm install --save @okgrow/react-native-copilot@https://github.com/okgrow/react-native-copilot#master