react-native-copilot icon indicating copy to clipboard operation
react-native-copilot copied to clipboard

Change Arrow Color and backdrop color

Open AishwaryaSurana opened this issue 6 years ago • 5 comments

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 avatar Nov 22 '18 09:11 AishwaryaSurana

@AishwaryaSurana Can you try rgba instead of rgb? like backdropColor:"rgba(0, 0, 0, 0.9)".

mohebifar avatar Nov 23 '18 20:11 mohebifar

I tried rgba as well. It didn't work.

AishwaryaSurana avatar Dec 03 '18 05:12 AishwaryaSurana

Same problem with @AishwaryaSurana in Android

ghost avatar Dec 06 '18 13:12 ghost

Are you using ViewMask? Changing the overlay color is currently possible only with SvgMask.

mohebifar avatar Dec 07 '18 17:12 mohebifar

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

Manhazito avatar Mar 01 '19 02:03 Manhazito